buildinfo

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

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:

  1. injected — set via ldflags `-X github.com/dotwaffle/peeringdb-plus/internal/buildinfo.injected=<value>` at Docker build time (computed from `git describe --tags --always --dirty`). This is the production path: tagged releases emit `v1.17`, post-tag dev builds emit `v1.17-3-gabc1234`, dirty trees emit a `-dirty` suffix.
  2. Main.Version from runtime/debug.ReadBuildInfo — populated for `go install` of a tagged module path (the module-proxy path).
  3. vcs.revision (first 7 chars) from build settings — `go build` from a local checkout with `.git` present.
  4. Literal "unknown" — last resort.

Without injection (e.g. under `go test`), the test-mode binaries fall 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 Version

func Version() string

Version returns the resolved build version. See package doc for the resolution order. The result is computed once per call but is cheap; callers may still cache at package init if they need a stable string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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