buildinfo

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package buildinfo exposes version/commit/date/dirty strings that the release pipeline injects via -ldflags -X. When ldflags are not set, an init() fallback reads `runtime/debug.BuildInfo` so `go install ...@v0.3.0` and local `go build` from a git checkout still produce a binary that reports its origin. None of the functions here panic; --version is required to succeed in all build modes (spec §7.1).

Resolution priority per field:

  1. -ldflags -X (release builds via goreleaser) — highest priority
  2. runtime/debug.BuildInfo — when running `go install …@<tag>` or building from a git checkout. `Main.Version` carries the module tag (or pseudo-version), and `Settings[vcs.*]` carries the commit/time/dirty flag that the toolchain stamps in module-aware builds (Go ≥ 1.18).
  3. Defaults ("dev" / "unknown") — last resort, e.g. cross-compiled stripped binaries with vcs stamping disabled.

Index

Constants

This section is empty.

Variables

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

Injected at link time via goreleaser:

-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Version={{.Version}}'
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Commit={{.ShortCommit}}'
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Date={{.Date}}'
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Dirty={{.IsGitDirty}}'

init() below populates any var still at its default from runtime/debug.BuildInfo so binaries built via `go install` or plain `go build` from a git checkout still self-identify.

Functions

func DirtyBool

func DirtyBool() bool

DirtyBool parses Dirty ("true"/"false") into a bool. Anything not "true" (case-sensitive) is false.

func Features

func Features() []string

Features returns the compile-time feature flags. "kuzu" joined the list in phase 2 with the Kuzu wrapper landing under internal/graph.

func GoVersion

func GoVersion() string

GoVersion returns the Go toolchain version the binary was built with.

func Platform

func Platform() string

Platform returns "<GOOS>/<GOARCH>", e.g. "linux/amd64".

Types

This section is empty.

Jump to

Keyboard shortcuts

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