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.
build: tolerate build without git repo
tisonc8c3d7c1a295
diff --git a/Makefile b/Makefileindex 875d874a..2a2ccfc1 100644--- a/Makefile+++ b/Makefile@@ -6,7 +6,7 @@ DIR_SRC=./cmd/answerDOCKER_CMD=dockerGO_ENV=CGO_ENABLED=0 GO111MODULE=on-Revision=$(shell git rev-parse --short HEAD)+Revision=$(shell git rev-parse --short HEAD 2&>/dev/null || echo "")GO_FLAGS=-ldflags="-X github.com/apache/incubator-answer/cmd.Version=$(VERSION) -X 'github.com/apache/incubator-answer/cmd.Revision=$(Revision)' -X 'github.com/apache/incubator-answer/cmd.Time=`date +%s`' -extldflags -static"GO=$(GO_ENV) $(shell which go)diff --git a/cmd/main.go b/cmd/main.goindex f57cc4b5..ec7413a0 100644--- a/cmd/main.go+++ b/cmd/main.go@@ -44,9 +44,10 @@ var (// Version is the version of the projectVersion = "0.0.0"// Revision is the git short commit revision number- Revision = "-"+ // If built without a Git repository, this field will be empty.+ Revision = ""// Time is the build time of the project- Time = "-"+ Time = ""// GoVersion is the go version of the projectGoVersion = "1.19"// log level