make+build: compile go version into binary
This commit is contained in:
parent
07420835d0
commit
d66f15d01f
2
Makefile
2
Makefile
@ -38,6 +38,7 @@ GOBUILD := GO111MODULE=on go build -v
|
|||||||
GOINSTALL := GO111MODULE=on go install -v
|
GOINSTALL := GO111MODULE=on go install -v
|
||||||
GOTEST := GO111MODULE=on go test
|
GOTEST := GO111MODULE=on go test
|
||||||
|
|
||||||
|
GOVERSION := $(shell go version | awk '{print $$3}')
|
||||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
||||||
GOLIST := go list -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
|
GOLIST := go list -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
|
||||||
GOLISTCOVER := $(shell go list -deps -f '{{.ImportPath}}' ./... | grep '$(PKG)' | sed -e 's/^$(ESCPKG)/./')
|
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) \
|
make_ldflags = $(shell echo -ldflags \"-X $(PKG)/build.Commit=$(COMMIT) \
|
||||||
-X $(PKG)/build.CommitHash=$(COMMIT_HASH) \
|
-X $(PKG)/build.CommitHash=$(COMMIT_HASH) \
|
||||||
|
-X $(PKG)/build.GoVersion=$(GOVERSION) \
|
||||||
-X $(PKG)/build.RawTags=$(shell echo $(1) | sed -e 's/ /,/g')\")
|
-X $(PKG)/build.RawTags=$(shell echo $(1) | sed -e 's/ /,/g')\")
|
||||||
|
|
||||||
LDFLAGS := $(call make_ldflags, ${tags})
|
LDFLAGS := $(call make_ldflags, ${tags})
|
||||||
|
@ -24,6 +24,10 @@ var (
|
|||||||
// RawTags contains the raw set of build tags, separated by commas. This
|
// RawTags contains the raw set of build tags, separated by commas. This
|
||||||
// should be set using -ldflags during compilation.
|
// should be set using -ldflags during compilation.
|
||||||
RawTags string
|
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
|
// semanticAlphabet is the set of characters that are permitted for use in an
|
||||||
|
Loading…
Reference in New Issue
Block a user