buildinfo

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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"
	ReleaseDate = ""
)

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"`
	ReleaseDate string `json:"release_date,omitempty"`
}

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" for release/update metadata; the public root --version display removes that prefix for human-readable output.

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