Skip to content

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.

optimize: update makefile for newer version of golang sdk.

mingchengaeddf79da25f
diff --git a/Makefile b/Makefile
index d5c46a40..239f3848 100644
--- a/Makefile
+++ b/Makefile
@@ -5,26 +5,26 @@ BIN=answer
DIR_SRC=./cmd/answer
DOCKER_CMD=docker
-#GO_ENV=CGO_ENABLED=0
+GO_ENV=CGO_ENABLED=0
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:
- @$(GO_ENV) $(GO) build $(GO_FLAGS) -o $(BIN) $(DIR_SRC)
+build: generate
+ @$(GO) build $(GO_FLAGS) -o $(BIN) $(DIR_SRC)
# https://dev.to/thewraven/universal-macos-binaries-with-go-1-16-3mm3
-universal:
+universal: generate
@GOOS=darwin GOARCH=amd64 $(GO_ENV) $(GO) build $(GO_FLAGS) -o ${BIN}_amd64 $(DIR_SRC)
@GOOS=darwin GOARCH=arm64 $(GO_ENV) $(GO) build $(GO_FLAGS) -o ${BIN}_arm64 $(DIR_SRC)
@lipo -create -output ${BIN} ${BIN}_amd64 ${BIN}_arm64
@rm -f ${BIN}_amd64 ${BIN}_arm64
generate:
- go get github.com/google/wire/cmd/wire@latest
- go install github.com/golang/mock/[email protected]
- go generate ./...
- go mod tidy
+ @$(GO) get github.com/google/wire/cmd/wire@latest
+ @$(GO) install github.com/golang/mock/[email protected]
+ @$(GO) generate ./...
+ @$(GO) mod tidy
test:
@$(GO) test ./internal/repo/repo_test