-
Notifications
You must be signed in to change notification settings - Fork 2
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
SONARGO-57 Reduce the size of the Go binary #68
Conversation
15a7b26
to
ce70260
Compare
sonar-go-to-slang/Makefile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makefile
was unused in scripts and not mentioned in the readme 🤷♀️
sonar-go-to-slang/make.sh
Outdated
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"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main reduction (and for all platfroms) is achieved with -ldflags="-s -w"
which removes debug info from the binary. However, static linking almost doesn't affect the size (2.3M -> 2.4M) and should make the Linux executable run on wider selection of platforms
Quality Gate passed for 'Go'Issues Measures |
SONARGO-57