version

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

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

View Source
var BuildTime = ""

BuildTime is the build/commit timestamp in RFC3339 format, or empty if unknown.

View Source
var Commit = ""

Commit is the git commit SHA, or empty if unknown.

View Source
var Modified = false

Modified is true if the working tree had uncommitted changes at build time.

View Source
var Version = "dev"

Version is the release tag. Defaults to "dev" for local builds.

Functions

func ModuleVersion added in v0.43.0

func ModuleVersion(path string) string

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.

func String

func String() string

String returns a human-readable one-line description of the build.

Types

This section is empty.

Jump to

Keyboard shortcuts

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