diff --git a/Makefile b/Makefile index 9d480601..4f3ddbba 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ GOBUILD := GO111MODULE=on go build -v GOINSTALL := GO111MODULE=on go install -v GOTEST := GO111MODULE=on go test +GOVERSION := $(shell go version | awk '{print $$3}') GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*") GOLIST := go list -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/' GOLISTCOVER := $(shell go list -deps -f '{{.ImportPath}}' ./... | grep '$(PKG)' | sed -e 's/^$(ESCPKG)/./') @@ -53,6 +54,7 @@ DEV_TAGS := $(if ${tags},$(DEV_TAGS) ${tags},$(DEV_TAGS)) make_ldflags = $(shell echo -ldflags \"-X $(PKG)/build.Commit=$(COMMIT) \ -X $(PKG)/build.CommitHash=$(COMMIT_HASH) \ + -X $(PKG)/build.GoVersion=$(GOVERSION) \ -X $(PKG)/build.RawTags=$(shell echo $(1) | sed -e 's/ /,/g')\") LDFLAGS := $(call make_ldflags, ${tags}) diff --git a/build/version.go b/build/version.go index d863adab..2895f60c 100644 --- a/build/version.go +++ b/build/version.go @@ -24,6 +24,10 @@ var ( // RawTags contains the raw set of build tags, separated by commas. This // should be set using -ldflags during compilation. RawTags string + + // GoVersion stores the go version that the executable was compiled + // with. This hsould be set using -ldflags during compilation. + GoVersion string ) // semanticAlphabet is the set of characters that are permitted for use in an