Documentation
¶
Overview ¶
Package version provides utilities to get the Go module version information. This package also allows us to inject build time variables such as commit hash. When we run this in Docker in Kubernetes, we want to be able to introspectively identify what source code generated the runtime we encounter. See https://github.com/StevenACoffman/small for more information Also https://blog.alexellis.io/inject-build-time-vars-golang/ These variables may be injected at build time in the Docker container Please see the README.md for more information as to how this is done here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
GitVersion string `json:"gitVersion"`
ModuleSum string `json:"moduleChecksum"`
GitCommit string `json:"gitCommit"`
GitTreeState string `json:"gitTreeState"`
BuildDate string `json:"buildDate"`
BuiltBy string `json:"builtBy"`
GoVersion string `json:"goVersion"`
Compiler string `json:"compiler"`
Platform string `json:"platform"`
ASCIIName string `json:"-"`
Name string `json:"-"`
Description string `json:"-"`
URL string `json:"-"`
}
Info provides the version info.
func GetVersionInfo ¶
GetVersionInfo returns build information for the running binary.
func GetVersionInfoFrom ¶
GetVersionInfoFrom builds an Info from an explicit BuildInfo value. Passing nil returns an Info with all VCS fields set to "unknown" and current runtime values for GoVersion, Compiler, and Platform. This is useful for testing without touching global state.
func (*Info) JSONString ¶
JSONString returns the JSON representation of the version info.
type Option ¶
type Option func(i *Info)
Option can be used to customize the Info after it is gathered from the environment.
func WithASCIIName ¶
WithASCIIName allows you to add an ASCII art of the name.
func WithAppDetails ¶
WithAppDetails allows to set the app name and description.
func WithBuiltBy ¶
WithBuiltBy allows to set the builder name/builder system name.