Documentation ¶
Overview ¶
TODO: clean up this file
Index ¶
- Constants
- Variables
- func ExecCmd(cmd *exec.Cmd) error
- func GeneratedGoPackage(grp model.Group) string
- func GetGoModule() string
- func GetGoPkg() string
- func GetModuleRoot() string
- func GoBuild(opts GoCmdOptions) error
- func GoCmd(cmd string, opts GoCmdOptions) error
- func GoModOn() (bool, error)
- func GoModPath() string
- func GoPackage(grp model.Group) string
- func GoTest(opts GoTestOptions) error
- func KubeCodegen(group, version, apiDir string, generators []string) error
- func Kubectl(stdin io.Reader, args ...string) error
- func KubectlApply(manifest []byte, extraArgs ...string) error
- func KubectlCmd(stdin io.Reader, args ...string) *exec.Cmd
- func KubectlDelete(manifest []byte, extraArgs ...string) error
- func KubectlOut(stdin io.Reader, args ...string) (string, error)
- func MarshalYaml(m proto.Message) ([]byte, error)
- func MustGetFileDir() string
- func MustGetThisDir() string
- func MustGetThisFile() string
- func MustGetwd() string
- func MustSetWdGopath(currentGopath string) string
- func ParseGoMod() *modfile.File
- func RunMake(target string, opts ...func(*exec.Cmd)) error
- func SetGoVerbose() error
- func UnmarshalYaml(data []byte, into proto.Message) error
- func WdInGoPathSrc() (bool, error)
- type GoCmdOptions
- type GoTestOptions
Constants ¶
const ( GoPathEnv = "GOPATH" GoFlagsEnv = "GOFLAGS" GoModEnv = "GO111MODULE" SrcDir = "src" )
Variables ¶
var JsonPbMarshaler = &jsonpb.Marshaler{}
Functions ¶
func GeneratedGoPackage ¶
gets the go package for the group's generated code. same as GoPackage if the types do not come from custom imports
func GetGoPkg ¶
func GetGoPkg() string
GetGoPkg returns the current directory's import path by parsing it from wd if this project's repository path is rooted under $GOPATH/src, or from go.mod the project uses Go modules to manage dependencies.
Example: "github.com/example-inc/app-operator"
func GoModOn ¶
From https://github.com/golang/go/wiki/Modules:
You can activate module support in one of two ways: - Invoke the go command in a directory outside of the $GOPATH/src tree, with a valid go.mod file in the current directory or any parent of it and the environment variable GO111MODULE unset (or explicitly set to auto). - Invoke the go command with GO111MODULE=on environment variable set.
GoModOn returns true if Go modules are on in one of the above two ways.
func KubeCodegen ¶
Possible generators: (deepcopy,defaulter,client,lister,informer) or "all"
func KubectlApply ¶
func KubectlDelete ¶
func MustGetThisDir ¶
func MustGetThisDir() string
returns absolute path to the diretory containing the .go file containing the calling function
func MustGetThisFile ¶
func MustGetThisFile() string
returns absolute path to the .go file containing the calling function
func MustSetWdGopath ¶
MustSetWdGopath sets GOPATH to the first element of the path list in currentGopath that prefixes the wd, then returns the set path. If GOPATH cannot be set, MustSetWdGopath exits.
func ParseGoMod ¶
func SetGoVerbose ¶
func SetGoVerbose() error
SetGoVerbose sets GOFLAGS="${GOFLAGS} -v" if GOFLAGS does not already contain "-v" to make "go" command output verbose.
func WdInGoPathSrc ¶
Types ¶
type GoCmdOptions ¶
type GoCmdOptions struct { // BinName is the name of the compiled binary, passed to -o. BinName string // Args are args passed to "go {cmd}", aside from "-o {bin_name}" and // test binary args. // These apply to build, clean, get, install, list, run, and test. Args []string // PackagePath is the path to the main (go build) or test (go test) packages. PackagePath string // Env is a list of environment variables to pass to the cmd; // exec.Command.Env is set to this value. Env []string // Dir is the dir to run "go {cmd}" in; exec.Command.Dir is set to this value. Dir string }
GoCmdOptions is the base option set for "go" subcommands.
type GoTestOptions ¶
type GoTestOptions struct { GoCmdOptions // TestBinaryArgs are args passed to the binary compiled by "go test". TestBinaryArgs []string }
GoTestOptions is the set of options for "go test".