good

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 3

README

🌳Common Go Tasks

This is a collection of common go commands that I've put into a command branch for inclusion into my z Bonzai stateful command tree. The name good is so that I can also be used as a standalone good binary without conflict even though I have go as an alias for it.

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var BuildDirName = `build`
View Source
var BuildNameDelim = `-`
View Source
var Cmd = &Z.Cmd{
	Name:      `go`,
	Aliases:   []string{`good`},
	Version:   `v0.1.4`,
	Summary:   `go helper commands and tasks`,
	Copyright: `Copyright 2022 Robert S Muhlestein`,
	License:   `Apache-2.0`,
	Commands:  []*Z.Cmd{help.Cmd, buildCmd},
}

Functions

func Build

func Build(path string) error

Build looks for a build.yaml file and does a go build as specified normally producing a build directory within the same directory as the build.yaml file. If no Name is set the name of the directory containing the build.yaml file is be used. If Dir is not set then the package variable BuildDirName is used.

Types

type BuildParams

type BuildParams struct {

	// name of the binary to build
	Name string

	// delimiter between name, os, arch (BuildNameDelim)
	Delim string

	// relative directory to that containing build.yaml in which to build
	Dir string

	// target os and architectures to build
	Targets []BuildTarget

	// preserve anything extra in the yaml file when marshaling
	O map[string]any `yaml:",inline"`
}

func ReadBuildParams

func ReadBuildParams(path string) (*BuildParams, error)

ReadBuildParams looks in the path for build.yaml and returns a BuildParams from it.

Example
package main

import (
	"fmt"

	"github.com/rwxrob/good"
)

func main() {
	bp, err := good.ReadBuildParams(`testdata/foo`)

	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(bp.Targets[0])

}
Output:
{windows [amd64]}

func (BuildParams) YAML

func (bp BuildParams) YAML() string

type BuildTarget

type BuildTarget struct {
	OS   string   // go dist compatible os (GOOS)
	Arch []string // go dist compatible arch (GOARCH)
}

Directories

Path Synopsis
cmd
good command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL