Documentation
¶
Overview ¶
Package buildinfo resolves the running binary's version and commit metadata using a layered fallback: ldflag-injected values > module pseudo-version > VCS settings embedded by Go 1.18+ > literal "dev".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
// Version is a human-readable version string. Possible shapes:
// "v1.2.3" — release tag (ldflag or @v1.2.3 install)
// "abc1234" — short SHA when no tag is available
// "abc1234 (2026-05-12)" — pseudo-version rendered from go install ...@latest
// "abc1234+dirty" — built from a tree with uncommitted changes
// "dev" — no metadata at all (go build -trimpath -buildvcs=false, etc.)
Version string
// Commit is the full or short SHA, or "unknown" if unavailable.
Commit string
// BuildTime is an ISO-8601 timestamp from ldflags or vcs.time, or "unknown".
BuildTime string
// Dirty is true when the binary was built from a working tree with
// uncommitted edits. Callers should disable any "is my binary up to date"
// comparison when Dirty is true — vcs.revision in that case is the parent
// commit, not what's actually running.
Dirty bool
}
Info is the resolved metadata for the running binary.
func FromBuildtime ¶
FromBuildtime resolves Info using the supplied ldflag values and the running binary's embedded debug.BuildInfo.
Click to show internal directories.
Click to hide internal directories.