feat: add build revision and build time
This commit is contained in:
parent
2042200f27
commit
c558219628
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