Documentation
¶
Overview ¶
Package cli implements the otag command line.
Index ¶
Constants ¶
const ( ExitOK = 0 ExitError = 1 ExitUsage = 2 ExitRetryable = 75 // EX_TEMPFAIL: safe to retry )
Exit codes.
const EnvelopeVersion = 1
EnvelopeVersion is the version of the --json output envelope.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Build ¶
type Build struct {
Version string `json:"version"`
Commit string `json:"commit"`
Date string `json:"date"`
}
Build identifies the binary. The release build injects it with -ldflags (-X main.version, main.commit, main.date); ResolveBuild fills the gaps for builds without ldflags such as `go install`.
func ResolveBuild ¶
ResolveBuild replaces unset build values (empty, "dev", "none", "unknown") with what runtime/debug.ReadBuildInfo knows: the module version of a `go install pkg@version` build and the VCS revision and time of a local build.
type Env ¶
type Env struct {
Stdin io.Reader // hook payloads (`otag event`)
Stdout, Stderr io.Writer
Getenv func(string) string
// Environ lists the environment (for prefix matches such as LC_*); nil = the
// variable names of os.Environ, looked up through Getenv.
Environ func() []string
Cwd string
// Build identifies the binary for `otag version`; see ResolveBuild.
Build Build
}
Env is the process environment the CLI runs in; injected for tests.