52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
|
package version
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// BuildInfo contains nativized version information.
|
||
|
type BuildInfo struct {
|
||
|
// TagVersion is the most recent tag name on the current branch.
|
||
|
TagVersion string
|
||
|
// PostTagCommits is the number of commits after BuildInfo.TagVersion's commit on the current branch.
|
||
|
PostTagCommits uint
|
||
|
// CommitHash is the full commit hash.
|
||
|
CommitHash string
|
||
|
// CommitId is the "short" version of BuildInfo.CommitHash.
|
||
|
CommitId string
|
||
|
// BuildUser is the user the program was compiled under.
|
||
|
BuildUser string
|
||
|
// If compiled under sudo, BuildInfo.RealBuildUser is the user that called sudo.
|
||
|
RealBuildUser string
|
||
|
// BuildTime is the time and date of the program's build time.
|
||
|
BuildTime time.Time
|
||
|
// BuildHost is the host the binary was compiled on.
|
||
|
BuildHost string
|
||
|
// Dirty specifies if the source was "dirty" (uncommitted/unstaged etc. files) at the time of compilation.
|
||
|
Dirty bool
|
||
|
// SourceControl is the source control version used. Only relevant if not a "clean" build or untagged.
|
||
|
SourceControl string
|
||
|
// Major is the major version, expressed as an uint per spec.
|
||
|
Major uint
|
||
|
// Minor is the minor version, expressed as an uint per spec.
|
||
|
Minor uint
|
||
|
// Patch is the patch version, expressed as an uint per spec.
|
||
|
Patch uint
|
||
|
// Pre
|
||
|
Pre string
|
||
|
// Build
|
||
|
Build string
|
||
|
// isDefined specifies if this version was retrieved from the built-in values.
|
||
|
isDefined bool
|
||
|
// raw is the raw variable values.
|
||
|
raw map[string]string
|
||
|
/*
|
||
|
verSplit is a slice of []string{Major, Minor, Patch, PreRelease, Build}
|
||
|
|
||
|
If using an actual point release, PreRelease and Build are probably blank.
|
||
|
*/
|
||
|
verSplit [5]string
|
||
|
// short is the condensed version of verSplit.
|
||
|
short string
|
||
|
}
|