Documentation ¶
Overview ¶
Package versionx provides a single location for setting the version on infratographer binaries. You can set these values at build time using:
-X go.infratographer.com/x/versionx.appName=NAME -X go.infratographer.com/x/versionx.version=VERSION -X go.infratographer.com/x/versionx.gitCommit=GIT_SHA -X go.infratographer.com/x/versionx.buildDate=DATE -X go.infratographer.com/x/versionx.builder=USER
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintVersion ¶
func PrintVersion(lgr *zap.SugaredLogger)
PrintVersion will print out the details of the current build. If a logger is provided they will be printed with the logger, otherwise they will just be printed as output.
func RegisterCobraCommand ¶
RegisterCobraCommand will add a version command to the cobra command provided that prints out the version. An optional logger may be provided at which point the version will be printed as an Info level log with the logger.
Types ¶
type Details ¶
type Details struct { AppName string `json:"app"` Version string `json:"version"` Commit string `json:"commit,omitempty"` BuiltAt *time.Time `json:"built_at,omitempty"` Builder string `json:"builder"` }
Details stores all the information collected about a version.
func BuildDetails ¶
func BuildDetails() *Details
BuildDetails will return a Details struct containing all the values that were set at build time to provide you the current version information.