buildinfo

package
v1.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package buildinfo resolves the version agent-manager reports: what the build stamped with -ldflags -X when it did, else what the Go toolchain recorded from version control — the tag at HEAD as the module version, the commit and its time — so a binary built from a tagged checkout names its release without a build flag. The generated release pipeline passes no -X, so the 1.1.8 image said dev.

Index

Constants

View Source
const (
	DevVersion    = "dev"
	UnknownCommit = "unknown"
	UnknownDate   = "unknown"
)

The ldflags defaults a build without -X leaves in place.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Version string
	Commit  string
	Date    string
}

Info is the resolved build identity.

func Read

func Read(version, commit, date string) Info

Read resolves the build identity from the ldflags values and the running binary's build info.

func Resolve

func Resolve(version, commit, date string, bi *debug.BuildInfo) Info

Resolve keeps every ldflags value that was set and fills the ones left at their defaults from bi: the main module's version as a release version, the short VCS revision with -dirty for a modified working tree, the commit time.

Jump to

Keyboard shortcuts

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