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" buildUser = "unknown" appName = "unknown"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintFull ¶
func PrintFull()
PrintFull prints the application name and detailed version information.
func SemverFromVersionNum ¶
SemverFromVersionNum provides the inverse functionality of VersionNum, allowing us to collect and report the integer version in a readable semver format
func VersionNum ¶
func VersionNum() int
VersionNum returns an integer representing the version value set at build time. see VersionNumFromSemver for additional details regarding the general translation process and limitations. this will return 0 if version is unset/unknown
func VersionNumFromSemver ¶
VersionNumFromSemver parses the semver version string to look for only the major.minor.patch portion, splits that into 3 parts (disregarding any extra portions), and applies a multiplier to each part to generate a total int value representing the semver. note that this will generate a sortable, and reversible integer as long as all parts remain less than 1000 This is currently intended for use in generating comparable versions to set within windows registry entries, allowing for an easy "upgrade-only" detection configuration within intune. Zero is returned for any case where the version cannot be reliably translated. VersionNumFromSemver should be used where the build time version value cannot be controlled- to restrict translations to the internally set version, use VersionNum
Types ¶
type Info ¶
type Info struct { Version string `json:"version"` Branch string `json:"branch"` Revision string `json:"revision"` GoVersion string `json:"go_version"` BuildDate string `json:"build_date"` BuildUser string `json:"build_user"` }
Info is a structure with version build information about the current application.