buildinfo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package buildinfo exposes metadata embedded by the Go linker at build time.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Overridden via -ldflags -X at release build time.
	Version   = "dev"
	Commit    = "unknown"
	BuildDate = "unknown"
)

Functions

func NormalizeVersion

func NormalizeVersion(v string) string

NormalizeVersion ensures release versions are "vX.Y.Z". Leaves "dev" and already-prefixed values unchanged.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildDate string `json:"build_date"`
}

Info is safe-to-print build metadata.

func Current

func Current() Info

Current returns embedded build metadata. Version is normalized to include a leading "v" when it looks like a SemVer without one, so brew tests can assert `version_info["version"] == "v#{version}"`.

func (Info) IsDevelopment

func (info Info) IsDevelopment() bool

IsDevelopment reports whether this is a local/dev build.

Jump to

Keyboard shortcuts

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