A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
feat: add build revision and build time
LinkinStarc55821962842
diff --git a/Makefile b/Makefileindex 1efe1b08..8592b00e 100644--- a/Makefile+++ b/Makefile@@ -6,7 +6,8 @@ DIR_SRC=./cmd/answerDOCKER_CMD=dockerGO_ENV=CGO_ENABLED=0-GO_FLAGS=-ldflags="-X main.Version=$(VERSION) -X 'main.Time=`date`' -extldflags -static"+Revision=$(shell git rev-parse --short HEAD)+GO_FLAGS=-ldflags="-X main.Version=$(VERSION) -X main.Revision=$(Revision) -X 'main.Time=`date`' -extldflags -static"GO=$(GO_ENV) $(shell which go)build:diff --git a/cmd/answer/command.go b/cmd/answer/command.goindex 0d42ba80..306f1cb0 100644--- a/cmd/answer/command.go+++ b/cmd/answer/command.go@@ -18,7 +18,7 @@ var ()func init() {- rootCmd.Version = Version+ rootCmd.Version = fmt.Sprintf("%s\nrevision: %s\nbuild time: %s", Version, Revision, Time)initCmd.Flags().StringVarP(&dataDirPath, "data-path", "C", "/data/", "data path, eg: -C ./data/")diff --git a/cmd/answer/main.go b/cmd/answer/main.goindex 1cb54347..3d813b0f 100644--- a/cmd/answer/main.go+++ b/cmd/answer/main.go@@ -20,6 +20,10 @@ var (Name = "answer"// Version is the version of the projectVersion = "development"+ // Revision is the git short commit revision number+ Revision = ""+ // Time is the build time of the project+ Time = ""// log levellogLevel = os.Getenv("LOG_LEVEL")// log path