yuluo-yx commented on code in PR #19:
URL:
https://github.com/apache/hertzbeat-collector-go/pull/19#discussion_r2384210928
##########
tools/make/golang.mk:
##########
@@ -18,46 +18,37 @@
VERSION_PACKAGE :=
hertzbeat.apache.org/hertzbeat-collector-go/internal/cmd/version
GO_LDFLAGS += -X $(VERSION_PACKAGE).hcgVersion=$(shell cat VERSION) \
--X $(VERSION_PACKAGE).gitCommitID=$(GIT_COMMIT)
+ -X $(VERSION_PACKAGE).gitCommitID=$(GIT_COMMIT)
GIT_COMMIT:=$(shell git rev-parse HEAD)
-GOOS ?= $(shell go env GOOS)
-GOARCH ?= $(shell go env GOARCH)
-
##@ Golang
.PHONY: fmt
fmt: ## Golang fmt
- @$(LOG_TARGET)
go fmt ./...
.PHONY: vet
vet: ## Golang vet
- @$(LOG_TARGET)
go vet ./...
.PHONY: dev
dev: ## Golang dev, run main by run.
- @$(LOG_TARGET)
go run cmd/main.go server --config etc/hertzbeat-collector.yaml
.PHONY: prod
prod: ## Golang prod, run bin by run.
- @$(LOG_TARGET)
bin/collector server --config etc/hertzbeat-collector.yaml
.PHONY: build
-build: GOOS = linux
+# build
build: ## Golang build
- @$(LOG_TARGET)
@version=$$(cat VERSION); \
# todo; 添加交叉编译支持
- CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o bin/collector
-ldflags "$(GO_LDFLAGS)" cmd/main.go
Review Comment:
这只能在当前系统下编译?似乎对交叉编译不友好?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]