Documentation
¶
Overview ¶
Package version centralizes build-identity reporting for both cmd/core-agent and cmd/core-agent-tui. The package vars are overridable at release time via -ldflags; plain `go build` falls back to the VCS metadata Go embeds when -buildvcs=true (the default since Go 1.18) so dev builds still report a real SHA.
Release process (see docs/release-process.md):
go build -ldflags "\ -X github.com/go-steer/core-agent/v2/internal/version.Version=v2.2.0 \ -X github.com/go-steer/core-agent/v2/internal/version.Commit=$(git rev-parse HEAD) \ -X github.com/go-steer/core-agent/v2/internal/version.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ) \ " ./cmd/core-agent ./cmd/core-agent-tui
After cutting a tag, bump Version below to the next minor + "-dev" (e.g. v2.1.0 release → main becomes v2.2.0-dev) so post-release dev builds report their next-target version.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version is the semver tag for released builds, or vX.Y.Z-dev // for in-development builds. Bump this manually on main right // after cutting a release so post-release builds report the // next target version. Enforced by // dev/ci/presubmits/verify-version-fallback so drift caught in // v2.4→v2.5→v2.6 (skipped bumps produced stale --version output // on go-installed binaries during the v2.7.0-dev.N demo drive) // can't happen again silently. Version = "v2.7.0" // Commit is the git SHA the binary was built from. Defaults to // "none" so the debug.BuildInfo fallback can detect that nothing // was injected; release builds get the full SHA via -ldflags. Commit = "none" // Date is the build timestamp in ISO 8601. Same default-sentinel // pattern as Commit. Date = "unknown" )
Build-time metadata. Defaults assume an in-development build off main; release-time -ldflags injection overrides them with the real tag, commit, and build date.
Functions ¶
func String ¶
String renders the build identity for a --version flag. prog is the binary name (e.g. "core-agent", "core-agent-tui") so the format starts with what the operator typed.
Format:
<prog> <semver> (commit <8-char-sha>[, modified], built <date>)
The leading two tokens are always (prog, version) so scripts can grep without parsing the parenthesized suffix.
Types ¶
This section is empty.