version

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package version reports which billet this is.

TWO SOURCES, IN ORDER, and neither is enough on its own.

GoReleaser stamps the tag into the vars below with -ldflags. Go 1.24+ also records the VCS tag in the binary by itself, which covers everyone who built with a plain `go build` or installed with `go install module@v0.1.0`. Relying only on the second would be one build flag away from silently reporting "(devel)" in a release artifact — GoReleaser passes -trimpath and its own flags, and -buildvcs=false or a build from a tarball with no .git produces exactly that.

It matters more than a version string usually does: billet sends this to GitHub as part of its client system info on every poll, so a deployment showing up in their telemetry is identifiable as billet rather than as nothing in particular.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare added in v0.6.0

func Compare(a, b string) (int, bool)

Compare orders two release tags.

STRICT vX.Y.Z AND NOTHING ELSE, and the second answer is the one that matters. A development build reports "(devel)", a snapshot reports 0.0.0-SNAPSHOT-<sha> and an unstamped binary "(unknown)"; none of those is older or newer than a release, so ordering one would be a guess dressed as a verdict. ok is false whenever either side is not a release tag, and every caller that refuses or records on the strength of this answer does neither when it is false. That is what keeps a downgrade guard from refusing a developer's own build against a ledger it has every right to open.

The result is negative when a is older than b, zero when they name the same release and positive when a is newer.

func Dirty

func Dirty() bool

Dirty reports whether the tree had uncommitted changes at build time.

func IsRelease added in v0.6.0

func IsRelease(v string) bool

IsRelease reports whether a string is a release tag Compare can order.

func Revision

func Revision() string

Revision is the commit this binary was built from, or "" if nothing recorded one.

func String

func String() string

String is the one-line description a bug report will quote.

func Version

func Version() string

Version is the release this binary was built from.

Types

This section is empty.

Jump to

Keyboard shortcuts

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