version: use runtime.Version() directly
Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
parent
8d0d1ebb63
commit
eaef634ef7
3
Makefile
3
Makefile
@ -23,7 +23,6 @@ DESTDIR ?= /usr/local
|
||||
VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always)
|
||||
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
|
||||
PACKAGE=github.com/containerd/containerd
|
||||
GOVERSION=$(shell go version | awk '{print $$3}')
|
||||
|
||||
ifneq "$(strip $(shell command -v go 2>/dev/null))" ""
|
||||
GOOS ?= $(shell go env GOOS)
|
||||
@ -92,7 +91,7 @@ endif
|
||||
GO_BUILDTAGS ?= seccomp apparmor
|
||||
GO_BUILDTAGS += ${DEBUG_TAGS}
|
||||
GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(GO_BUILDTAGS)",)
|
||||
GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -X $(PKG)/version.GoVersion=$(GOVERSION) $(EXTRA_LDFLAGS)'
|
||||
GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
|
||||
SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'
|
||||
|
||||
#Replaces ":" (*nix), ";" (windows) with newline for easy parsing
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package version
|
||||
|
||||
import "runtime"
|
||||
|
||||
var (
|
||||
// Package is filled at linking time
|
||||
Package = "github.com/containerd/containerd"
|
||||
@ -27,6 +29,6 @@ var (
|
||||
// the program at linking time.
|
||||
Revision = ""
|
||||
|
||||
// GoVersion is filled at linking time
|
||||
GoVersion = ""
|
||||
// GoVersion is Go tree's version.
|
||||
GoVersion = runtime.Version()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user