Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release job issue #145

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: nit
leovct committed Nov 2, 2023
commit 868c373f98ea5dfc37bd153459abb74cea0c882a
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -41,17 +41,19 @@ install: build ## Install the go binary.

.PHONY: cross
cross: $(BUILD_DIR) ## Cross-compile go binaries using CGO.
# Note: `go build -s -w` enables to strip debug and suppress warnings.
# Notes:
# - `-s -w` enables to strip debug and suppress warnings.
# - `-linkmode external -extldflags "-static-libgo"` allows dynamic linking.
echo "Building linux-arm64-$(BIN_NAME)..."
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build \
-ldflags "$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static-libgo"" \
-ldflags '$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static-libgo"' \
-tags netgo \
-o $(BUILD_DIR)/linux-arm64-$(BIN_NAME) \
main.go

echo "Building linux-amd64-$(BIN_NAME)..."
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
-ldflags "$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static-libgo"" \
-ldflags '$(VERSION_FLAGS) -s -w -linkmode external -extldflags "-static-libgo"' \
-tags netgo \
-o $(BUILD_DIR)/linux-amd64-$(BIN_NAME) \
main.go