Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Arch string = runtime.GOARCH
CPU architecture of the running binary.
var BuildHost string
BuildHost stores the hostname of the machine where the binary was built. Set via -ldflags "-X main.BuildHost=$(hostname)"
var BuildTime string
BuildTime stores the build timestamp in UTC. Set via -ldflags "-X main.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
var BuildUser string
BuildUser is the username of the person or system that initiated the build process. Set via -ldflags "-X main.BuildUser=$(whoami)"
var Compiler string = runtime.Compiler
Compiler that built the running binary.
var GitBranch string
GitBranch holds the name of the Git branch from which the build was created. Set via -ldflags "-X main.GitBranch=$(git rev-parse --abbrev-ref HEAD)"
var GitCommit string
GitCommit stores the latest Git commit hash. Set via -ldflags "-X main.GitCommit=$(git rev-parse HEAD)"
var GitState string
GitState indicates whether the working directory was "clean" or "dirty" (i.e., with uncommitted changes). Set via -ldflags "-X main.GitState=$(if git diff-index --quiet HEAD --; then echo 'clean'; else echo 'dirty'; fi)"
var GitTag string
GitTag represents the most recent Git tag at build time, if any. Set via -ldflags "-X main.GitTag=$(git describe --tags --abbrev=0)"
var GoVersion string
GoVersion captures the Go version used to build the binary. Typically, this can be obtained automatically with runtime.Version(), but you can set it manually. Set via -ldflags "-X main.GoVersion=$(go version | awk '{print $3}')"
var Os string = runtime.GOOS
OS the running binary was built for.
var Version string
Version indicates the version of the binary, such as a release number or semantic version. Set via -ldflags "-X main.Version=v1.0.0"
var VersionInfo = map[string]interface{}{ "version": Version, "tag": GitTag, "commit": GitCommit, "branch": GitBranch, "state": GitState, "build_timestamp": BuildTime, "build_host": BuildHost, "build_user": BuildUser, "go_version": GoVersion, "arch": Arch, "os": Os, }
VersionInfo is all of the fields above combined into a map to be logged.
Functions ¶
This section is empty.
Types ¶
This section is empty.