From 8334efebd456f673b282caf1b60c5108b8996426 Mon Sep 17 00:00:00 2001 From: kingecg Date: Mon, 23 Jun 2025 23:46:05 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E7=A6=81=E7=94=A8=20CGO=20=E4=BB=A5?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E8=B7=A8=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E8=87=B4=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 Makefile 中添加 CGO_ENABLED=0 环境变量 - 此修改确保在不同平台上构建时不会链接 CGO 依赖 - 提高了构建过程的可移植性和一致性 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 63b86e4..828114e 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ +Makefile ARCHS := linux-amd64 linux-arm64 darwin-amd64 VERSION ?= $(shell git describe --tags --always) all: $(ARCHS) $(ARCHS): @echo "Building for $(@)" - @GOOS=$(word 1,$(subst -, ,$(@))) GOARCH=$(word 2,$(subst -, ,$(@))) \ + @GOOS=$(word 1,$(subst -, ,$(@))) GOARCH=$(word 2,$(subst -, ,$(@))) CGO_ENABLED=0 \ go build -ldflags "-X main.Version=$(VERSION)" -o target/$(@)/gohttpd cp config.json target/$(@)/ cp -r adminui target/$(@)/