Documentation ¶
Overview ¶
Package buildinfo hosts build info variables populated via ldflags.
For testing, you can override the build version using envar SQ_BUILD_VERSION (panics if not a valid semver).
Index ¶
Constants ¶
View Source
const DefaultVersion = "v0.0.0-dev"
DefaultVersion is the default value for Version if not set via ldflags.
View Source
const EnvOverrideVersion = `SQ_BUILD_VERSION`
EnvOverrideVersion is used for testing build version, e.g. for config upgrades.
Variables ¶
View Source
var ( // Version is the build version. If not set at build time via // ldflags, Version takes the value of DefaultVersion. Version = DefaultVersion // Commit is the commit hash. Commit string // Timestamp is the timestamp of when the cli was built. Timestamp string )
Functions ¶
func IsDefaultVersion ¶ added in v0.21.0
func IsDefaultVersion() bool
IsDefaultVersion returns true if Version is empty or DefaultVersion.
Types ¶
type Info ¶ added in v0.21.0
type Info struct { Version string `json:"version" yaml:"version"` Commit string `json:"commit,omitempty" yaml:"commit,omitempty"` Timestamp time.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` }
Info encapsulates Version, Commit and Timestamp.
func Get ¶ added in v0.39.0
func Get() Info
Get returns Info. If buildinfo.Timestamp cannot be parsed, the returned Info.Timestamp will be the zero value.
func (Info) ShortCommit ¶ added in v0.47.0
ShortCommit returns the short commit hash.
Click to show internal directories.
Click to hide internal directories.