Help us shape the future of Go! Take the 2026 Go Developer Survey

buildinfo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package buildinfo names the build: version, commit and build time. The release build and the Dockerfile set them with -ldflags; a build without them (go build, go install, go run) reads the Go build info instead (ADR 0034).

Index

Constants

This section is empty.

Variables

View Source
var (
	Version string
	Commit  string
	Date    string
)

Set by -ldflags "-X github.com/getsphericon/sphericon/internal/buildinfo.Version=..." etc.

Functions

func Bare

func Bare(v string) string

Bare is v without the leading "v" ("0.1.0"), the form of archive names and Results.

func IsRelease

func IsRelease(v string) bool

IsRelease reports whether v is a stable release version ("v1.2.3", "1.2.3"): a plain semantic version, not "dev", a commit-derived pseudo-version, a prerelease or one with build metadata. It is the one answer to "is this a release" for the Telemetry report and the Release check (ADR 0032).

func Semver

func Semver(v string) string

Semver is v in the "v1.2.3" form golang.org/x/mod/semver wants, whether it came with the leading "v" or without ("0.1.0", the form release archives and `--version` use).

Types

type Info

type Info struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
	Date    string `json:"built"`
}

Info is one build.

func Current

func Current() Info

Current is the build of this binary.

func (Info) Line

func (i Info) Line() string

Line is the one-line form `sphericon version` prints.

Jump to

Keyboard shortcuts

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