mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/build-revision' into 'main'
feat: add build revision and build time See merge request opensource/answer!71
This commit is contained in:
commit
a2cc79ae82
3
Makefile
3
Makefile
|
@ -6,7 +6,8 @@ DIR_SRC=./cmd/answer
|
|||
DOCKER_CMD=docker
|
||||
|
||||
GO_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:
|
||||
|
|
|
@ -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/")
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@ var (
|
|||
Name = "answer"
|
||||
// Version is the version of the project
|
||||
Version = "development"
|
||||
// Revision is the git short commit revision number
|
||||
Revision = ""
|
||||
// Time is the build time of the project
|
||||
Time = ""
|
||||
// log level
|
||||
logLevel = os.Getenv("LOG_LEVEL")
|
||||
// log path
|
||||
|
|
Loading…
Reference in New Issue