diff --git a/src/go/Makefile b/src/go/Makefile index 7685c1ff..2b35ee85 100644 --- a/src/go/Makefile +++ b/src/go/Makefile @@ -18,6 +18,8 @@ endif GO := go pkgs = $(shell find . -type d -name "pt-*" -exec basename {} \;) +# VERSION ?=$(shell git describe --abbrev=0) doesn't always work here, need to use git log +VERSION ?=$(shell git log --no-walk --tags --pretty="%H %d" --decorate=short | head -n1 | awk -F'[, ]' '{ print $$4; }') BUILD=$(BUILD_DATE) GOVERSION=$(shell go version | cut --delimiter=" " -f3) GOUTILSDIR ?= $(GOPATH)/bin diff --git a/src/go/pt-k8s-debug-collector/main.go b/src/go/pt-k8s-debug-collector/main.go index 8121e1bc..c19a5e01 100644 --- a/src/go/pt-k8s-debug-collector/main.go +++ b/src/go/pt-k8s-debug-collector/main.go @@ -15,10 +15,10 @@ const ( // We do not set anything here, these variables are defined by the Makefile var ( - Build string - GoVersion string - Version string - Commit string + Build string //nolint + GoVersion string //nolint + Version string //nolint + Commit string //nolint ) func main() { diff --git a/src/go/pt-mongodb-index-check/main.go b/src/go/pt-mongodb-index-check/main.go index 4d7b3a90..9cd722fb 100644 --- a/src/go/pt-mongodb-index-check/main.go +++ b/src/go/pt-mongodb-index-check/main.go @@ -45,11 +45,12 @@ const ( TOOLNAME = "pt-mongodb-index-check" ) +// We do not set anything here, these variables are defined by the Makefile var ( - Build string = "2020-04-23" //nolint - GoVersion string = "1.14.1" //nolint - Version string = "3.5.1" //nolint - Commit string //nolint + Build string //nolint + GoVersion string //nolint + Version string //nolint + Commit string //nolint ) func main() { diff --git a/src/go/pt-mongodb-query-digest/main.go b/src/go/pt-mongodb-query-digest/main.go index 17587e7f..f5032f7f 100644 --- a/src/go/pt-mongodb-query-digest/main.go +++ b/src/go/pt-mongodb-query-digest/main.go @@ -38,11 +38,12 @@ const ( DEFAULT_SKIPCOLLECTIONS = "system.profile" // comma separated list ) +// We do not set anything here, these variables are defined by the Makefile var ( - Build string = "2020-04-23" //nolint - GoVersion string = "1.14.1" //nolint - Version string = "3.5.1" //nolint - Commit string //nolint + Build string //nolint + GoVersion string //nolint + Version string //nolint + Commit string //nolint ) type cliOptions struct { diff --git a/src/go/pt-mongodb-summary/main.go b/src/go/pt-mongodb-summary/main.go index 35fe7f08..2c8349d2 100644 --- a/src/go/pt-mongodb-summary/main.go +++ b/src/go/pt-mongodb-summary/main.go @@ -55,10 +55,11 @@ const ( //nolint:gochecknoglobals var ( - Build string = "2020-04-23" - GoVersion string = "1.14.1" - Version string = "3.5.1" - Commit string + // We do not set anything here, these variables are defined by the Makefile + Build string //nolint + GoVersion string //nolint + Version string //nolint + Commit string //nolint defaultConnectionTimeout = 3 * time.Second directConnection = true diff --git a/src/go/pt-pg-summary/main.go b/src/go/pt-pg-summary/main.go index 0ed491b6..979a10f1 100644 --- a/src/go/pt-pg-summary/main.go +++ b/src/go/pt-pg-summary/main.go @@ -17,11 +17,12 @@ import ( "github.com/percona/percona-toolkit/src/go/pt-pg-summary/templates" ) +// We do not set anything here, these variables are defined by the Makefile var ( - Build string = "2020-04-23" //nolint - Commit string //nolint - GoVersion string = "1.14.1" //nolint - Version string = "3.5.1" //nolint + Build string //nolint + GoVersion string //nolint + Version string //nolint + Commit string //nolint ) type connOpts struct { diff --git a/src/go/pt-secure-collect/Makefile b/src/go/pt-secure-collect/Makefile index 864fd56d..a07f24e9 100644 --- a/src/go/pt-secure-collect/Makefile +++ b/src/go/pt-secure-collect/Makefile @@ -1,6 +1,7 @@ GO := go pkgs = $(shell basename `git rev-parse --show-toplevel`) -VERSION ?=$(shell git describe --abbrev=0) +# VERSION ?=$(shell git describe --abbrev=0) doesn't always work here, need to use git log +VERSION ?=$(shell git log --no-walk --tags --pretty="%H %d" --decorate=short | head -n1 | awk -F'[, ]' '{ print $$4; }') BUILD ?=$(shell date +%FT%T%z) GOVERSION ?=$(shell go version | cut --delimiter=" " -f3) COMMIT ?=$(shell git rev-parse HEAD) diff --git a/src/go/pt-secure-collect/main.go b/src/go/pt-secure-collect/main.go index 2f61d5dd..396d2750 100644 --- a/src/go/pt-secure-collect/main.go +++ b/src/go/pt-secure-collect/main.go @@ -84,10 +84,11 @@ var ( "pt-mysql-summary --host=$mysql-host --port=$mysql-port --user=$mysql-user --password=$mysql-pass", } - Build string = "2020-04-23" //nolint - GoVersion string = "1.14.1" //nolint - Version string = "3.5.1" //nolint - Commit string //nolint + // We do not set anything here, these variables are defined by the Makefile + Build string //nolint + GoVersion string //nolint + Version string //nolint + Commit string //nolint ) func main() {