-
Notifications
You must be signed in to change notification settings - Fork 3
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: shave some size off the executable #68
Conversation
Trim symbol paths and remove DWARF debugging symbols from the built binaries. These slow compilation and increase binary size. If debugging information is necessary, a different build target could be used.
WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #68 +/- ##
=======================================
Coverage 90.40% 90.40%
=======================================
Files 13 13
Lines 521 521
=======================================
Hits 471 471
Misses 34 34
Partials 16 16 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
Makefile (1)
27-27
: Consider adding a debug build targetThe optimization for the local build is consistent with the container build, which is great for maintaining parity. However, stripping debug information might hinder local debugging.
Suggestion: Consider adding a separate debug build target that retains debugging information for local development use.
Example of a debug build target:
.PHONY: build-debug build-debug: dist mod CGO_ENABLED=0 go build -o dist/chinmina-bridge-debug .This allows developers to choose between optimized and debug builds as needed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- .goreleaser.yaml (1 hunks)
- Makefile (1 hunks)
🔇 Additional comments (2)
Makefile (1)
25-25
: Excellent optimization for container build!The addition of
-ldflags="-w" -trimpath
flags is a great improvement:
-w
strips DWARF debugging information, reducing binary size.-trimpath
removes file system paths, enhancing security by eliminating potentially sensitive information.These changes align perfectly with the PR objectives of reducing binary size and trimming symbol paths.
.goreleaser.yaml (1)
13-14
: Approve changes with considerations for debuggingThe addition of
flags: "-trimpath"
andldflags: "-w"
aligns well with the PR objectives:
-trimpath
removes file system paths from the binary, which can slightly reduce size and improve build reproducibility.-w
omits the DWARF symbol table, significantly reducing binary size.These changes will effectively reduce the size of the built binaries as intended. However, they come with trade-offs:
- Debugging in production environments will be more challenging.
- Stack traces will have less information, potentially making issue diagnosis more difficult.
To ensure these changes don't negatively impact the project's debugging capabilities, please run the following script:
If any of these searches return results, we may need to reconsider the impact of these changes or provide alternative debugging solutions.
Trim symbol paths and remove DWARF debugging symbols from the built binaries. These slow compilation and increase binary size.
If debugging information is necessary, a different build target could be used.
The binary size metric is not driving this change, but more of a nice-to-have. Trimming module paths removes irrelevant information from any traces that are emitted, and speeding the build time helps development cycle time.
Summary by CodeRabbit