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 ¶
ShortCommit returns the commit truncated to the customary 12 characters, or the full value when it is shorter (for example "unknown").
Click to show internal directories.
Click to hide internal directories.