fix: Windows 交叉编译添加 CGO_ENABLED=0
All checks were successful
Release / build (push) Successful in 6m28s
All checks were successful
Release / build (push) Successful in 6m28s
This commit is contained in:
7
build.sh
7
build.sh
@@ -68,6 +68,7 @@ while [[ $# -gt 0 ]]; do
|
||||
;;
|
||||
windows/amd64)
|
||||
GOOS=windows GOARCH=amd64
|
||||
CGO_ENABLED=0
|
||||
PLATFORM="windows-amd64"
|
||||
if [[ "$OUTPUT_NAME" == "yoyo" ]]; then
|
||||
OUTPUT_NAME="yoo-windows-amd64.exe"
|
||||
@@ -84,11 +85,13 @@ done
|
||||
|
||||
echo "Building yoyo version: $VERSION"
|
||||
|
||||
BUILD_CMD="go build -buildvcs=false -ldflags \"-s -w -X github.com/titor/fanyi/internal/logo.version=${VERSION}\" -o \"$OUTPUT_NAME\" ./cmd/yoyo"
|
||||
|
||||
if [ -n "$GOOS" ]; then
|
||||
echo "Target: $PLATFORM"
|
||||
go build -buildvcs=false -ldflags "-s -w -X github.com/titor/fanyi/internal/logo.version=${VERSION}" -o "$OUTPUT_NAME" ./cmd/yoyo
|
||||
eval CGO_ENABLED=${CGO_ENABLED:-0} $BUILD_CMD
|
||||
else
|
||||
go build -buildvcs=false -ldflags "-s -w -X github.com/titor/fanyi/internal/logo.version=${VERSION}" -o "$OUTPUT_NAME" ./cmd/yoyo
|
||||
eval CGO_ENABLED=${CGO_ENABLED:-0} $BUILD_CMD
|
||||
fi
|
||||
|
||||
echo "Build complete: ./$OUTPUT_NAME"
|
||||
Reference in New Issue
Block a user