Documentation
¶
Overview ¶
Package buildinfo exposes version/commit/date/dirty strings that the release pipeline injects via -ldflags -X. When ldflags are not set, an init() fallback reads `runtime/debug.BuildInfo` so `go install ...@v0.3.0` and local `go build` from a git checkout still produce a binary that reports its origin. None of the functions here panic; --version is required to succeed in all build modes (spec §7.1).
Resolution priority per field:
- -ldflags -X (release builds via goreleaser) — highest priority
- runtime/debug.BuildInfo — when running `go install …@<tag>` or building from a git checkout. `Main.Version` carries the module tag (or pseudo-version), and `Settings[vcs.*]` carries the commit/time/dirty flag that the toolchain stamps in module-aware builds (Go ≥ 1.18).
- Defaults ("dev" / "unknown") — last resort, e.g. cross-compiled stripped binaries with vcs stamping disabled.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "unknown" Date = "unknown" Dirty = "false" )
Injected at link time via goreleaser:
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Version={{.Version}}'
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Commit={{.ShortCommit}}'
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Date={{.Date}}'
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Dirty={{.IsGitDirty}}'
init() below populates any var still at its default from runtime/debug.BuildInfo so binaries built via `go install` or plain `go build` from a git checkout still self-identify.
Functions ¶
func DirtyBool ¶
func DirtyBool() bool
DirtyBool parses Dirty ("true"/"false") into a bool. Anything not "true" (case-sensitive) is false.
func Features ¶
func Features() []string
Features returns the compile-time feature flags. "kuzu" joined the list in phase 2 with the Kuzu wrapper landing under internal/graph.
Types ¶
This section is empty.