Skip to content

Reduce binary size with build flags#102

Merged
az-smartling merged 2 commits into
masterfrom
reduce_binary_size
May 18, 2026
Merged

Reduce binary size with build flags#102
az-smartling merged 2 commits into
masterfrom
reduce_binary_size

Conversation

@az-smartling

Copy link
Copy Markdown
Contributor
  • Added -trimpath -ldflags="-s -w" and CGO_ENABLED=0 to the cross-platform build rule in the Makefile
  • Binary size drops from ~15 MB to ~10 MB (~33%)

@az-smartling az-smartling requested review from dimitrystd and junky May 15, 2026 11:13

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Go build command in the Makefile to include CGO_ENABLED=0, -trimpath, and -ldflags="-s -w" for optimized and reproducible builds. Feedback suggests extracting these hardcoded flags into variables to improve maintainability and allow for easier local debugging, as well as injecting version information into the binary using linker flags.

Comment thread Makefile Outdated

@dimitrystd dimitrystd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was lazy to read docs about these flags. I hope we will get developer-friendly stack traces from the clients (in case of error).

@az-smartling

Copy link
Copy Markdown
Contributor Author

For everyday error stack traces - yes, they'll be readable. For attaching a debugger or profiling a production binary — no, that requires overriding LDFLAGS at build time.

@az-smartling az-smartling merged commit d978cbe into master May 18, 2026
@az-smartling az-smartling deleted the reduce_binary_size branch May 18, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants