version

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package version resolves build metadata for the running binary.

Version resolution is delegated to clive: an ldflag-injected version when the build sets one (mise run install, GoReleaser), falling back to debug.BuildInfo so `go install ...@latest` and plain `go build` binaries report a real version instead of "dev". Commit, build time, and dirtiness come from the VCS metadata Go embeds at build time — no ldflags needed. Branch and BuildBy are jira-specific ldflags that clive does not model.

Index

Constants

This section is empty.

Variables

View Source
var (
	Branch  = "unknown"
	BuildBy = "unknown"
)

Linker-injected build metadata clive does not model. Set via -ldflags; "unknown" otherwise.

Functions

func BuildTime

func BuildTime() string

BuildTime returns the commit timestamp (RFC 3339) embedded by the build, or "unknown" when no VCS info is present.

func Commit

func Commit() string

Commit returns the short VCS revision the binary was built from, or "unknown" when the build embedded no VCS info.

func Dirty added in v0.10.0

func Dirty() bool

Dirty reports whether the binary was built from a tree with uncommitted changes.

func String

func String() string

String returns the one-line "version (commit)" summary.

func Version

func Version() string

Version returns the resolved version string (see the package comment for the resolution order). It falls back to "dev" when no source resolves — e.g. `go run`, which embeds neither ldflags nor VCS info — so the version envelope field is never empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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