Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version = "unknown" Commit = "unknown" BuildDate = "unknown" )
Build-time variables set via -ldflags
Functions ¶
func Branch ¶ added in v0.2.1
func Branch() string
Branch returns the release channel this binary was built from: the tag name for tagged releases (e.g. "v0.2.0"), the branch name for branch builds (e.g. "main" for "main:abc123"), and empty for unknown versions. See BranchOf.
func BranchOf ¶ added in v0.16.0
BranchOf derives the release channel from a version string as produced by hack/build.sh. A detached checkout reports its branch as "HEAD", which is not a channel anything publishes under; it is treated as "main" so installers pick the main image and release bundle rather than failing on a channel named HEAD.
Types ¶
type Info ¶
type Info struct {
Version string `json:"version"`
Commit string `json:"commit"`
BuildDate time.Time `json:"build_date"`
}
Info represents version information
func (Info) KnownCommit ¶ added in v0.16.0
KnownCommit returns the commit this binary was built from, or "" when the build did not stamp one. Commit's zero value is the literal "unknown", which is fine to print but must not travel anywhere a missing commit means something.