Documentation
¶
Overview ¶
Package buildinfo resolves the running binary's version metadata. It reads ldflags-injected overrides (set via `-X` at build time) and falls back to `runtime/debug.ReadBuildInfo()` when the overrides are sentinel values, so `go install module@version` binaries still report useful metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Version = "dev" Commit = "unknown" Date = "unknown" )
Set via -ldflags at build time (see Makefile). These act as overrides. They are package-level var so the linker can write to them; keep the names stable — the Makefile's LDFLAGS refers to them by full symbol path (github.com/RandomCodeSpace/docsiq/internal/buildinfo.Version etc.).
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Version string `json:"version"`
Commit string `json:"commit"`
BuildDate string `json:"build_date"`
GoVersion string `json:"go_version"`
Dirty string `json:"dirty"` // "true", "false", or "unknown"
Deps map[string]string `json:"deps,omitempty"`
}
Info holds resolved version metadata for the running binary.
func Resolve ¶
Resolve returns the current version metadata using:
- -ldflags overrides (if non-sentinel)
- runtime/debug.ReadBuildInfo() (module version + VCS settings)
- "unknown" for any remaining field
When includeDeps is true, the returned Info also lists the main module's direct dependencies (Path → Version). Transitive deps are omitted because they bloat the response without real diagnostic value.