← Back to Pull requests

ci: Strip release binaries of debug symbols used by debuggers #3309

Closed
unknown closed this pull request without merging on Nov 27, 2026 11:09 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 15:30 UTC
Author

Linking with -s -w could reduce the binary size significantly. Alloy has also been using these flags.

According to Go's documentation:

-s
	Omit the symbol table and debug information.
	Implies the -w flag, which can be negated with -w=0.
-w
	Omit the DWARF symbol table.

My AI agent says that only debuggers will be impacted by this:

<details>
<summary>What <code>-s -w</code> changes in a release build</summary>

| Feature | With -s -w | Why |
|---|---|---|
| Runtime | | |
| Program behavior and performance | ✅ Unchanged | The code and data the OS loads are identical; only unloaded sections are removed. |
| Panic and crash stack traces (function names, file:line) | ✅ Works | Built from .gopclntab, which is kept. |
| Goroutine dumps (SIGQUIT, /debug/pprof/goroutine?debug=2) | ✅ Works | Same as above. |
| runtime.Caller, runtime.FuncForPC, debug.Stack(), log file:line | ✅ Works | Same as above. |
| Reflection and type names | ✅ Works | Type metadata (.go.type) is kept. |
| Profiling | | |
| pprof profiles (BEYLA_PROFILE_PORT, go tool pprof) | ✅ Works | The Go runtime writes function names into the profile itself. |
| Go-aware continuous profilers (Pyroscope, OTel eBPF profiler) | ✅ Works | They read .gopclntab. |
| Linux perf report | ❌ Raw addresses only | perf reads .symtab/DWARF, not .gopclntab. |
| Build info and scanning | | |
| go version -m, debug.ReadBuildInfo() | ✅ Works | .go.buildinfo is kept. |
| Dependency and CVE scanners (Trivy, Grype, Syft) | ✅ Works | They read the module list from build info. |
| govulncheck -mode=binary | ⚠️ Should work | It reads build info and .gopclntab. Not tested on a stripped binary. |
| Go build ID (go tool buildid) | ✅ Works | It's in a kept note section. |
| Debugging and inspection | | |
| Delve / gdb: breakpoints, stepping, printing variables | ❌ Disabled | Needs DWARF (removed by -w). Use mise run compile:debug. |
| Core dump analysis with variables and types (dlv core) | ❌ Disabled | Needs DWARF. |
| nm, go tool nm, objdump, go tool objdump function names | ❌ Disabled | They read the symbol table (removed by -s). |
| addr2line and other address-to-source tools | ❌ Disabled | Needs DWARF or the symbol table. |
| External uprobes on Beyla's own functions by name (bpftrace, perf probe) | ❌ Disabled | They resolve function names through .symtab. Beyla instrumenting other apps is unaffected. |
| Size | | |
| Binary size (v3.43.0, linux/amd64) | ⬇️ 193.2 → ~141 MB | DWARF and symbol table removed (~52 MB). |
| Release tarball (gzip) | ⬇️ 72.9 → ~39.7 MB | Debug info compresses poorly, so stripping saves even more after compression. |

Linker flag reference: cmd/link. Debug builds (compile:debug) and the coverage builds used by integration tests are unchanged.

</details>

A few open questions:
It'd be good to test this, but I'm not sure what the most worthwhile tests would be?
Is this change a ci or a feat? One could argue that it's removing a feature...

Diff: 403 lines (+302 / -101) across 5 files Reviewer: mariomac Review duration: 1178m
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 403 lines diff across 5 files
0.45
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.359
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3309"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 44.8% (MEDIUM) · Higher = larger blast radius
44.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 17.7% · Safe to merge
17.7%
Repository