Documentation
¶
Overview ¶
Package buildinfo exposes the build-time version string used by both the PeeringDB User-Agent and the OTel resource so they stay in lockstep.
Resolution order:
- injected: set with ldflags `-X github.com/dotwaffle/peeringdb-plus/internal/buildinfo.injected=<value>` only when a Docker build gets an explicit VERSION build argument, for a build context without .git.
- Main.Version from runtime/debug.ReadBuildInfo. `go build` in a git checkout stamps it (Go 1.24 and later): the tag on a tagged commit (v1.32.0), a pseudo-version between tags (v1.32.1-0.20260925001332-10674814d276), and a +dirty suffix when the tree differs from the commit. This is the production path: both Dockerfiles keep .git and every tracked file in the build context. `go install` of a tagged module path also sets it.
- vcs.revision (first 7 chars) from build settings, for a build that recorded the commit but no module version.
- Literal "unknown": last resort.
A `go test` binary has no version stamp and falls through to (3) or (4). The peeringdb User-Agent test asserts the surrounding shape, not the version literal, so test runs stay stable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SourceTime ¶ added in v1.25.0
SourceTime returns the UTC source timestamp recorded by the Go toolchain. It returns the zero time when build information or vcs.time is unavailable or malformed.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.