version

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2023 License: GPL-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VersionInfo

type VersionInfo struct {
	Version string
	Commit  string
}

func Version

func Version(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("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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL