Skip to content

Commit

Permalink
Remove external linking
Browse files Browse the repository at this point in the history
  • Loading branch information
petertrr committed Jan 6, 2025
1 parent 5ac8415 commit 1dc4a38
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions sonar-go-to-slang/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,10 @@ compile_binaries() {
mkdir -p build/executable
# Note: -ldflags="-s -w" is used to strip debug information from the binary and reduce its size.
GO_FLAGS=(-ldflags='-s -w' -buildmode=exe)
GOOS=darwin GOARCH=amd64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-darwin-amd64 "${GO_FLAGS[@]}"
GOOS=darwin GOARCH=arm64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-darwin-arm64 "${GO_FLAGS[@]}"
if command -v musl-gcc &> /dev/null; then
# This should be run on CI; for a dev environment, this is not essential
GOOS=linux GOARCH=amd64 CC=musl-gcc ${path_to_binary} build -o build/executable/sonar-go-to-slang-linux-amd64 "${GO_FLAGS[@]}" -ldflags '-linkmode external -extldflags "-s -w -static"'
else
GOOS=linux GOARCH=amd64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-linux-amd64 "${GO_FLAGS[@]}"
fi
GOOS=windows GOARCH=amd64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-windows-amd64.exe "${GO_FLAGS[@]}"
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-darwin-amd64 "${GO_FLAGS[@]}"
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-darwin-arm64 "${GO_FLAGS[@]}"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-linux-amd64 "${GO_FLAGS[@]}"
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 ${path_to_binary} build -o build/executable/sonar-go-to-slang-windows-amd64.exe "${GO_FLAGS[@]}"
}

generate_test_report() {
Expand Down

0 comments on commit 1dc4a38

Please sign in to comment.