version

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package version reports what build this is.

The values are injected at link time. A build without them reports "dev" rather than an empty string or a plausible-looking version: a binary that cannot say what it is should say so, not guess.

Index

Constants

View Source
const (
	SourceRelease = "release"
	SourceLocal   = "local"
)

The two origins that matter. Anything else is a build we cannot account for, and is treated as local — the cautious reading, since it is the one that refuses to overwrite.

Variables

View Source
var (
	Version = ""
	Commit  = ""
	Date    = ""
	// Source is how this binary was produced. Only the release pipeline sets
	// it to SourceRelease; every other path leaves it as it found it.
	//
	// It is a separate variable rather than a shape inferred from Version
	// because `update` refuses to overwrite a binary it did not publish, and a
	// decision like that should not rest on parsing a string that anyone can
	// pass on a command line.
	Source = ""
)

Injected via -ldflags at build time.

Functions

func IsRelease

func IsRelease() bool

IsRelease reports whether the release pipeline produced this binary.

func Short

func Short() string

Short returns the version alone.

func String

func String() string

String returns version, commit, date and platform.

Types

This section is empty.

Jump to

Keyboard shortcuts

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