Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VersionInfo ¶
func Version ¶
func Version(name, version, gitDescribe, gitHash string) *VersionInfo
Version determines version and commit information based on multiple data sources:
- Version information dynamically added by `git archive` in the remaining to parameters.
- A hardcoded version number passed as first parameter.
- Commit information added to the binary by `go build`.
It's supposed to be called like this in combination with setting the `export-subst` attribute for the corresponding file in .gitattributes:
var Version = version.Version("acme", 1.0.0-rc2", "$Format:%(describe)$", "$Format:%H$")
When exported using `git archive`, the placeholders are replaced in the file and this version information is preferred. Otherwise the hardcoded version is used and augmented with commit information from the build metadata.
func (*VersionInfo) Print ¶
func (v *VersionInfo) Print()
Print writes verbose version output to stdout.
Click to show internal directories.
Click to hide internal directories.