Documentation
¶
Overview ¶
Package version exposes the build version of the binaries. The version is set by the linker (-X ...internal/version.build=<version>, as make build does with GIT_VERSION) and otherwise read from the module build information, so a plain go build or go install reports its module version or VCS revision. Both commands print it with -version and log it at start-up. PopulateFromBuild parses "[v]major.minor.commit[-dirty]".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Major uint `json:"major"`
Minor uint `json:"minor"`
Commit uint `json:"commi"`
Build string `json:"build"`
Runtime string `json:"runtime"`
// contains filtered or unexported fields
}
Info describes a version of an executable
func (Info) Float ¶
Float returns the version as one float32 for ordering: Major.Minor scaled by 1e6 plus Commit, so v1.2.114 gives 1200114 (the encoding of xpki's internal/version). It is lossy (v1.2.x and v1.20.x collide) and zero until PopulateFromBuild has parsed Build; nothing in this module calls it.
func (Info) GreaterOrEqual ¶
GreaterOrEqual returns true if the version 'v' is the same or new that the supplied parameter 'other' This only examines the Major & Minor field (as the SHA in Build provides no ordering indication)
func (*Info) PopulateFromBuild ¶
func (v *Info) PopulateFromBuild()
PopulateFromBuild parses the major, minor and commit values from Build, which is expected in the format [v]major.minor.commit[-dirty]; make build links it in from GIT_VERSION (see current.go). Values that do not match stay zero; it never panics, since a plain go build reports a module version or "devel".