build

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package build carries identifying information about the running binary.

Values are injected at link time via -ldflags; see the Makefile. When the binary is built without them (go run, go test, a plain go build) the values fall back to the module's VCS stamp where Go provides one, and to "dev" otherwise, so a version string is never empty.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	Date      string `json:"date"`
	GoVersion string `json:"go_version"`
	Platform  string `json:"platform"`
}

func Get

func Get() Info

Get returns the build information for this binary. It is safe for concurrent use and computes its answer once.

func (Info) ShortCommit

func (i Info) ShortCommit() string

ShortCommit returns the commit truncated to the customary 12 characters, or the full value when it is shorter (for example "unknown").

func (Info) String

func (i Info) String() string

Jump to

Keyboard shortcuts

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