Documentation ¶
Index ¶
- Constants
- func ExecCmd(cmd *exec.Cmd) error
- func GetOptionalInput(msg string) string
- func GetRequiredInput(msg string) string
- func GetStringArray(msg string) []string
- func GoModOn() (bool, error)
- func HasProjectFile() bool
- func ReadConfig() (*config.Config, error)
- func RewriteFileContents(filename, target, newContent string) error
- func SetGoVerbose() error
- type ErrUnknownOperatorType
- type InteractiveLevel
- type OperatorType
Constants ¶
const ( // Useful file modes. DirMode = 0755 FileMode = 0644 ExecFileMode = 0755 )
const ( // Go env vars. GoFlagsEnv = "GOFLAGS" GoModEnv = "GO111MODULE" )
Variables ¶
This section is empty.
Functions ¶
func GetOptionalInput ¶ added in v0.18.0
func GetRequiredInput ¶ added in v0.18.0
func GetStringArray ¶ added in v0.18.0
func GoModOn ¶ added in v0.8.0
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 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 HasProjectFile ¶ added in v1.0.0
func HasProjectFile() bool
HasProjectFile returns true if the project is configured as a kubebuilder project.
func ReadConfig ¶ added in v1.0.0
ReadConfig returns a configuration if a file containing one exists at the default path (project root).
func RewriteFileContents ¶ added in v0.18.0
RewriteFileContents adds newContent to the line after the last occurrence of target in filename's contents, then writes the updated contents back to disk.
func SetGoVerbose ¶ added in v0.8.0
func SetGoVerbose() error
SetGoVerbose sets GOFLAGS="${GOFLAGS} -v" if GOFLAGS does not already contain "-v" to make "go" command output verbose.
Types ¶
type ErrUnknownOperatorType ¶ added in v0.8.0
type ErrUnknownOperatorType struct {
Type string
}
func (ErrUnknownOperatorType) Error ¶ added in v0.8.0
func (e ErrUnknownOperatorType) Error() string
type InteractiveLevel ¶ added in v0.18.0
type InteractiveLevel int
InteractiveLevel captures the user preference on the generation of interactive commands.
const ( // User has not turned interactive mode on or off, default to off. InteractiveSoftOff InteractiveLevel = iota // User has explicitly turned interactive mode off. InteractiveHardOff // User only explicitly turned interactive mode on. InteractiveOnAll )
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 PluginKeyToOperatorType ¶ added in v1.0.0
func PluginKeyToOperatorType(pluginKey string) OperatorType
PluginKeyToOperatorType converts a plugin key string to an operator project type. TODO(estroz): this can probably be made more robust by checking known plugin keys directly.