diff --git a/Makefile b/Makefile index 2790d156..bb08efc0 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ CHECKER_BIN=$(PWD)/tmp/bin VERSION_PACKAGE := glide/pkg COMMIT ?= $(shell git describe --dirty --long --always --abbrev=15) -VERSION ?= "latest" # TODO: pull/pass a real version +BUILD_DATE ?= $(shell date +"%Y-%m-%d %H:%M:%S") +VERSION ?= "latest" -LDFLAGS_COMMON := "-s -w -X $(VERSION_PACKAGE).commitSha=$(COMMIT) -X $(VERSION_PACKAGE).version=$(VERSION)" +LDFLAGS_COMMON := "-s -w -X $(VERSION_PACKAGE).commitSha=$(COMMIT) -X $(VERSION_PACKAGE).version=$(VERSION) -X $(VERSION_PACKAGE).buildDate=$(BUILD_DATE)" .PHONY: help diff --git a/pkg/version.go b/pkg/version.go index a178cc64..5ad11003 100644 --- a/pkg/version.go +++ b/pkg/version.go @@ -13,8 +13,17 @@ var version = "devel" // and will be populated by the Makefile var commitSha = "unknown" +// buildDate captures the time when the build happened +var buildDate = "unknown" + var FullVersion string func init() { - FullVersion = fmt.Sprintf("%s (commit: %s, %s)", version, commitSha, runtime.Version()) + FullVersion = fmt.Sprintf( + "%s (commit: %s, runtime: %s, buildDate: %s)", + version, + commitSha, + runtime.Version(), + buildDate, + ) }