Documentation
¶
Overview ¶
Package version exposes build metadata injected at link time via -ldflags -X.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version is the semantic version of the CLI (e.g. "v1.2.3"). Version = "dev" // Commit is the git commit the binary was built from. Commit = "none" // Date is the build timestamp (RFC 3339). Date = "unknown" // InstallSource records how the binary was distributed ("source", "brew", // "goreleaser", "go-install"). Later issues (#15/#16) gate self-update on it. InstallSource = "source" )
These variables are overridden at build time. Defaults are chosen so a plain `go build` / `go install` (no ldflags) still produces sensible output.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Version string `json:"version" yaml:"version"`
Commit string `json:"commit" yaml:"commit"`
Date string `json:"date" yaml:"date"`
InstallSource string `json:"install_source" yaml:"install_source"`
}
Info bundles the build metadata for rendering.
func Current ¶
func Current() Info
Current returns the build metadata for this binary. When the ldflags were not applied — chiefly `go install github.com/vibexp/cli/cmd/vibexp@<tag>` — it falls back to the module version and VCS stamps embedded by the Go toolchain (debug.ReadBuildInfo), so the version is still reported correctly.