build(flags): add -trimpath to binary builds#264
Merged
Conversation
Strips local filesystem paths from compiled binaries, dropping the shim from 8.2 MB to 5.7 MB (-30%) and the main CLI by a similar proportion, with no runtime behavior change. Applied consistently across the rnr task runner, the PR build workflow, and the release workflow.
This was referenced May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-trimpathtogo buildinrnr.yaml(local builds) and both.github/workflows/build.ymland.github/workflows/release.yml(CI / release).Measured impact (local, Windows amd64,
-s -walready in place)dtvem-shim.exedtvem.exeSavings compound across the five release platforms (
windows-amd64/arm64,darwin-amd64/arm64,linux-amd64).What
-trimpathdoesReplaces absolute filesystem paths in the compiled binary with the module path. Runtime behavior is unchanged. The only user-visible difference is in panic stack traces, which show module-relative paths instead of build-machine paths — a positive for reproducibility/debuggability of shipped binaries.
Test plan
./rnr.cmd checkpasses (format, lint, full test suite — all packages OK)go buildwith new flags produces working binaries at the expected sizespython --version/node --versionto verify the runtime hot path is unaffectedNotes
./rnr buildtask has a pre-existing YAML-quoting bug that affects any task using-ldflags="-s -w". This PR does not fix it; tracked separately in fix(rnr): build task fails due to YAML quoting of -ldflags #263 (with upstream report fix(parser): cmd string with internally-quoted args is mistokenized rnr.cli#55). CI is unaffected because.github/workflows/{build,release}.ymlrun undershell: bash, which tokenizes the quoted flag correctly.Resolves #262