From d368caccf4420169783b44398f8aac0189bc282b Mon Sep 17 00:00:00 2001 From: WangXiangUSTC Date: Mon, 16 Nov 2020 10:08:42 +0800 Subject: [PATCH] update the output of version (#401) --- Makefile | 2 +- pkg/utils/printer.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9fa61e8e1..1b3707b68 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ path_to_add := $(addsuffix /bin,$(subst :,/bin:,$(GOPATH))) export PATH := $(path_to_add):$(PATH) -LDFLAGS += -X "github.com/pingcap/tidb-tools/pkg/utils.Version=1.0.0~rc2+git.$(shell git rev-parse --short HEAD)" +LDFLAGS += -X "github.com/pingcap/tidb-tools/pkg/utils.Version=$(shell git describe --tags --dirty --always)" LDFLAGS += -X "github.com/pingcap/tidb-tools/pkg/utils.BuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')" LDFLAGS += -X "github.com/pingcap/tidb-tools/pkg/utils.GitHash=$(shell git rev-parse HEAD)" LDFLAGS += -X "github.com/pingcap/tidb-tools/pkg/utils.GitBranch=$(shell git rev-parse --abbrev-ref HEAD)" diff --git a/pkg/utils/printer.go b/pkg/utils/printer.go index ce023169b..bd72c2738 100644 --- a/pkg/utils/printer.go +++ b/pkg/utils/printer.go @@ -32,7 +32,7 @@ var ( // GetRawInfo do what its name tells func GetRawInfo(app string) string { info := "" - info += fmt.Sprintf("%s: v%s\n", app, Version) + info += fmt.Sprintf("%s: %s\n", app, Version) info += fmt.Sprintf("Git Commit Hash: %s\n", GitHash) info += fmt.Sprintf("Git Branch: %s\n", GitBranch) info += fmt.Sprintf("UTC Build Time: %s\n", BuildTS)