buildinfo

package
v0.10.474 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package buildinfo holds build-time identifiers populated at link time. Keeping these in a leaf package lets both the CLI command layer and the runtime primitives reference them without creating an import cycle.

The public surface is intentionally minimal: a BuildInfo interface, a constructor, and a process-wide accessor. The implementation is a private struct that is constructed exactly once, at program start, from cmd/root.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(major, minor, patch, commitSHA, shortCommitSHA, date, platform string)

Init publishes the process-wide BuildInfo. It is intended to be called once from cmd/root.go's init(), after the -ldflags-populated string variables in the cmd package have been observed. Subsequent calls are no-ops.

Types

type BuildInfo

type BuildInfo interface {
	GetMajorVersion() string
	GetMinorVersion() string
	GetPatchVersion() string
	GetCommitSHA() string
	GetShortCommitSHA() string
	GetDate() string
	GetPlatform() string
	GetSemVersion() string
}

BuildInfo provides read-only access to build-time identifiers.

func Get

func Get() BuildInfo

Get returns the process-wide BuildInfo. Before Init is called it returns an instance with empty strings.

func NewBuildInfo

func NewBuildInfo(major, minor, patch, commitSHA, shortCommitSHA, date, platform string) BuildInfo

NewBuildInfo constructs an immutable BuildInfo from the given identifiers. SemVersion is derived from the major/minor/patch trio.

Jump to

Keyboard shortcuts

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