buildinfo

package
v0.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package buildinfo resolves build-time version information for the gonimbus binary. It is intentionally tiny and dependency-free so that the resolution logic remains predictable across build paths.

Resolution priority for the version string (highest first):

  1. Linker ldflags overrides — passed in via main as the `version` symbol. `make build` sets this from the VERSION file. Authoritative when set to anything other than the placeholder "dev".
  2. Embedded VERSION file — read at build time via `//go:embed VERSION`, kept in sync with the repo-root VERSION via `make sync-app-version`. This is the *repo's* statement of what version it is, which is what we want to report regardless of how the binary was produced. Notably: `go install ./cmd/...` from a working tree, `go build` from a clean checkout (which would otherwise return a Go pseudo-version derived from the latest tag), and any other build path without ldflags.
  3. runtime/debug.ReadBuildInfo Main.Version — only used as a final fallback if the embed is somehow empty. Generally not reached because the embed is bundled with the package.
  4. The literal "dev" — only if every source above is empty.

For commit and buildDate (which are NOT in the VERSION file), the order is ldflags → BuildInfo (vcs.revision, vcs.time) → "unknown". BuildInfo is the right fallback there because `go install module@vX.Y.Z` populates these settings from the module source even without ldflags.

See docs/architecture.md and gonimbus#6 for context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(ldVersion, ldCommit, ldBuildDate string) (version, commit, buildDate string)

Resolve returns the effective version, commit, and build date for the running binary. ldVersion/ldCommit/ldBuildDate are the ldflags-injected values from the main package; pass them through unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL