Documentation
¶
Overview ¶
Package version exposes build-time identity information about the vinculum binary.
Version is typically injected at build time via:
go build -ldflags="-X github.com/tsarna/vinculum/version.Version=v1.2.3"
Commit, BuildTime, and Modified are populated automatically from runtime/debug VCS stamping when available (i.e. when built from a git checkout with the .git directory present). Docker builds don't have access to .git, so the Dockerfiles inject all fields explicitly via ldflags instead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BuildTime = ""
BuildTime is the build/commit timestamp in RFC3339 format, or empty if unknown.
var Commit = ""
Commit is the git commit SHA, or empty if unknown.
var Modified = false
Modified is true if the working tree had uncommitted changes at build time.
var Version = "dev"
Version is the release tag. Defaults to "dev" for local builds.
Functions ¶
func ModuleVersion ¶ added in v0.43.0
ModuleVersion returns the recorded module version of the dependency with the given module path — e.g. ModuleVersion("github.com/tsarna/functy") might yield "v0.11.0" in a released build. It reads runtime/debug build info, so it needs no ldflags or cooperation from the dependency: a library cannot inject its own version the way a main package does with -ldflags, but its module version rides along in the importing binary's build info regardless.
It returns "(devel)" for a workspace or replace build (where no released version applies), and "" if the module is not a dependency or build info is unavailable. Note only the module *version* is recorded per dependency; a dependency's commit and build time are not — Go stamps VCS info (vcs.revision/vcs.time) for the main module only, so those describe this binary, not its dependencies.
func ShortCommit ¶
func ShortCommit() string
ShortCommit returns the first 12 characters of Commit, or Commit if shorter.
Types ¶
This section is empty.