version

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 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 Canonical added in v0.9.2

func Canonical(v string) (string, bool)

Canonical spells a release as its tag, vX.Y.Z, whichever way it arrived, and reports whether the string was a release at all.

func Compare added in v0.6.0

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

Compare orders two releases: -1, 0 or 1, and whether it could tell.

COULD-NOT-TELL IS A VERDICT OF ITS OWN, and a caller that collapses it into either answer is wrong: a developer's build, a snapshot and an unstamped binary reach every guard a release does, and none of them may be refused or waved through on the strength of an order that does not exist for them.

BOTH SPELLINGS OF A RELEASE ORDER, WITH AND WITHOUT THE LEADING v. A release binary stamps its version as GoReleaser's {{.Version}}, which is the tag without the v, and every release from v0.6.0 to v0.9.1 reported itself that way: in `billet version`, in its upgrade journals, in the release a node registers with, and to every guard that compared it with a channel's vX.Y.Z. Compare refused the bare form as "not a release", so on a release binary each of those guards was could-not-tell and fell through — checkDowngrade, the timer's older-target refusal, the starter's own, and the ledger's release watermark — and a stale rollout downgraded a control plane (2026-09-05). The canonical spelling is the tag, and Version() now speaks it; the bare form stays orderable because journals, node registrations and rollouts written by the earlier releases still carry it.

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: the grammar the config, the release source and the ledger's watermark accept. The bare form is not a tag, because a pin written without the v names a release GitHub has no tag for; Canonical is how a bare form becomes one.

func Revision

func Revision() string

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

func Same added in v0.9.2

func Same(a, b string) bool

Same reports whether two strings name one release, in either spelling. Two strings that cannot be ordered are the same only when they are identical, so "(devel)" is itself and nothing else.

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