Documentation
¶
Overview ¶
Package version exposes build-time metadata injected via -ldflags.
The variables Version, Commit, and BuiltAt are normally set by the Makefile (or CI) using linker flags. When they are not injected — most notably for `go install ...@vX.Y.Z` binaries, which cannot run ldflags — Current() falls back to the Go toolchain's own build information (debug.ReadBuildInfo): the module version, the VCS revision, and the VCS commit time. That fallback is still honest: it only ever reports metadata the toolchain itself recorded, and it keeps the plain "dev"/"unknown" values when the binary carries no such evidence (a plain `go build`/`go run` inside a module reports "(devel)", which stays "dev"). GSEER never claims a version it cannot substantiate (SPEC-03 §4: checksums, not signatures, in v0.0.1; `gseer doctor` prints the running binary's SHA-256).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version is the semantic version string, e.g. "v0.0.1". When built // without ldflags it is "dev" — Current() then tries the module // version recorded by the toolchain (set for `go install ...@vX.Y.Z`) // and reports "dev" only when that yields nothing. Version = "dev" // Commit is the VCS commit hash the binary was built from. Empty // when built without ldflags; Current() falls back to the toolchain's // vcs.revision stamp (full hash — unambiguous next to a release page) // and otherwise reports "unknown". Commit = "" // BuiltAt is the build timestamp in RFC3339 form. Empty when built // without ldflags; Current() falls back to the toolchain's vcs.time // stamp (also RFC3339) and otherwise reports "unknown". BuiltAt = "" )
Variables injected via -ldflags "-X ...". Defaults are intentionally honest: when not injected, we say so plainly rather than fabricating a version (AC-8.x documentation honesty; the honesty floor).
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Version string `json:"version"`
Commit string `json:"commit"`
BuiltAt string `json:"built_at"`
GoVersion string `json:"go_version"`
}
Info is the structured form of the build metadata. The CLI's `version` command renders this; future surfaces (doctor, /api/v1/version) reuse it.