Documentation ¶
Index ¶
- Constants
- func CheckAndGetProjectGoPkg() string
- func CheckGoProjectCmd(cmd *cobra.Command) error
- func ExecCmd(cmd *exec.Cmd) error
- func IsGoVerbose() bool
- func IsOperatorGo() bool
- func MustGetGopath() string
- func MustGetwd() string
- func MustInProjectRoot()
- func MustSetGopath(currentGopath string) string
- type OperatorType
Constants ¶
const ( GopathEnv = "GOPATH" GoFlagsEnv = "GOFLAGS" SrcDir = "src" )
Variables ¶
This section is empty.
Functions ¶
func CheckAndGetProjectGoPkg ¶ added in v0.2.0
func CheckAndGetProjectGoPkg() string
CheckAndGetProjectGoPkg checks if this project's repository path is rooted under $GOPATH and returns the current directory's import path e.g: "github.com/example-inc/app-operator"
func CheckGoProjectCmd ¶ added in v0.5.0
func IsGoVerbose ¶ added in v0.5.0
func IsGoVerbose() bool
IsGoVerbose returns true if GOFLAGS contains "-v". This function is useful when deciding whether to make "go" command output verbose.
func IsOperatorGo ¶ added in v0.5.0
func IsOperatorGo() bool
func MustGetGopath ¶ added in v0.5.0
func MustGetGopath() string
MustGetGopath gets GOPATH and ensures it is set and non-empty. If GOPATH is not set or empty, MustGetGopath exits.
func MustInProjectRoot ¶
func MustInProjectRoot()
MustInProjectRoot checks if the current dir is the project root and returns the current repo's import path e.g github.com/example-inc/app-operator
func MustSetGopath ¶ added in v0.5.0
MustSetGopath sets GOPATH=currentGopath after processing a path list, if any, then returns the set path. If GOPATH cannot be set, MustSetGopath exits.
Types ¶
type OperatorType ¶
type OperatorType = string
OperatorType - the type of operator
const ( // OperatorTypeGo - golang type of operator. OperatorTypeGo OperatorType = "go" // OperatorTypeAnsible - ansible type of operator. OperatorTypeAnsible OperatorType = "ansible" // OperatorTypeHelm - helm type of operator. OperatorTypeHelm OperatorType = "helm" // OperatorTypeUnknown - unknown type of operator. OperatorTypeUnknown OperatorType = "unknown" )
func GetOperatorType ¶
func GetOperatorType() OperatorType
GetOperatorType returns type of operator is in cwd This function should be called after verifying the user is in project root e.g: "go", "ansible"