buildinfo

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package buildinfo reports build-time metadata. Release builds inject exact values via -ldflags (GoReleaser); local/dev builds (the dev wrapper, `go build`) have none, so we recover what we can from the embedded VCS stamp (commit + dirty flag) and the binary's own mtime as the build time. Because the dev wrapper rebuilds on every launch, that mtime makes each dev build uniquely identifiable — so a boot banner can tell you exactly which build is running.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)

These are overridden at release time, e.g.:

-X github.com/memcode-ai/memcode/internal/buildinfo.Version=1.2.3
View Source
var DevBuild = ""

DevBuild is stamped "1" by the dev wrapper's ldflags. Default is OFF, so a release build (or any build that forgets the flag) can never accidentally show dev diagnostics.

Functions

func Compact

func Compact() string

Compact is the build identifier for the always-on footer — always a REAL version. A clean release shows just its semver (e.g. "1.2.3"); a dev build shows the synthesized baseVersion-dev+commit (e.g. "0.1.0-dev+a1b2c3d-dirty"), where the commit is the per-build identifier. No build timestamps — the footer carries a version, not a clock.

func IsDev

func IsDev() bool

IsDev reports whether this is a local/dev build: the dev wrapper stamps DevBuild=1 (it also stamps a real semver, so Version alone can't tell), and a bare `go build` has no ldflags at all (Version stays "dev").

func Short

func Short() string

Short is a compact identifier — "dev · a1b2c3d-dirty · built 11:02:05" — enough to tell two builds apart at a glance.

func String

func String() string

String is the full one-line version summary (for `memcode version`).

Types

This section is empty.

Jump to

Keyboard shortcuts

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