version: finish version setup
This setup will now correctly set the version number from the git tag. When using `--version`, we will see the binary name, the package it was built from and a git hash based on the tag: ```console $./bin/dist -v ./bin/dist github.com/docker/containerd 0b45d91.m ``` Note that in the above example, if we set a tag of `v1.0.0-dev`, that will show up in the version number, as follows: ```console $./bin/dist -v ./bin/dist github.com/docker/containerd v1.0.0-dev ``` Once commits are made past that tag, the version number will be expressed relative to that tag and include a git hash: ```console $./bin/dist -v ./bin/dist github.com/docker/containerd v1.0.0-dev-1-g7953e96.m ``` Some these examples include a `.m` postfix. This indicates that the binary was build from a source tree with local modifications. We can add a dev tag to start getting 1.0 version numbers for test builds. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
24
version.go
24
version.go
@@ -1,20 +1,12 @@
|
||||
package containerd
|
||||
|
||||
import "fmt"
|
||||
var (
|
||||
Package = "github.com/docker/containerd"
|
||||
|
||||
// VersionMajor holds the release major number
|
||||
const VersionMajor = 1
|
||||
// Version holds the complete version number.
|
||||
Version = "1.0-dev+unknown"
|
||||
|
||||
// VersionMinor holds the release minor number
|
||||
const VersionMinor = 0
|
||||
|
||||
// VersionPatch holds the release patch number
|
||||
const VersionPatch = 0
|
||||
|
||||
// Version holds the combination of major minor and patch as a string
|
||||
// of format Major.Minor.Patch
|
||||
var Version = fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
|
||||
|
||||
// GitCommit is filled with the Git revision being used to build the
|
||||
// program at linking time
|
||||
var GitCommit = ""
|
||||
// GitCommit is filled with the Git revision being used to build the
|
||||
// program at linking time
|
||||
GitCommit = ""
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user