Documentation
¶
Overview ¶
Package version provides utilities for displaying version information about a Go application.
To use this package, a program would set the package variables at build time, using the -ldflags go build flag.
Example:
go build -ldflags "-X github.com/kolide/kit/version.version=1.0.0"
Available values and defaults to use with ldflags:
version = "unknown" branch = "unknown" revision = "unknown" goVersion = "unknown" buildDate = "unknown" appName = "unknown"
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Print ¶
func Print()
Print outputs the application name and version string.
Example ¶
ExamplePrint tests the output of Print()
// Set up what we expect appName = "CoolAppplication" version = "v9.4.2.7-beta324" // Run the function Print()
Output: CoolAppplication v9.4.2.7-beta324
func PrintFull ¶
func PrintFull()
PrintFull prints the application name and detailed version information.
Example ¶
ExamplePrintFull tests the output of PrintFull()
// Set up what we expect appName = "OkayAppplication" version = "ver12.0" branch = "branch_branch" revision = "0a7aca6523e34c5a38f2da9d2a975a7cfa21ba42" buildDate = "2018-09-07 07:30:50.390193 -0700 PDT m=+0.003381227" goVersion = "go0.2" // Run the function PrintFull()
Output: OkayAppplication ver12.0 branch: branch_branch revision: 0a7aca6523e34c5a38f2da9d2a975a7cfa21ba42 build date: 2018-09-07 07:30:50.390193 -0700 PDT m=+0.003381227 go version: go0.2
Types ¶
Click to show internal directories.
Click to hide internal directories.