Log date · Wed
Does stripping a Go binary hide function names?
Not always. We compare normal and stripped builds, then review Go 1.27 traceback labels and macOS release checks.
Does stripping a Go binary hide function names?
Not necessarily. We built our own small program with Go 1.26.2. With -s -w, it fell from 2,573,344 bytes to 1,710,480 bytes. go tool nm no longer listed our function, but the exact name main.privatePricingRule remained in the binary. Both programs printed quote: 84.
Go 1.27.0 was released on 2026-08-19; its tag is dated 16:45 UTC. [1][3] Changes to closure names, traceback labels and macOS metadata make this a useful time to inspect release artifacts. [2]
| Question | Finding |
|---|---|
| Size after stripping? | 862,864 bytes smaller. |
| Does nm list the function? | Yes in the normal build; not in the stripped build. |
| Is the name still in the file? | An exact match exists in both. |
| Program output? | Both print quote: 84. |
Sample and build
We wrote a pricing function that multiplies its input by 7 above 10 and by 9 otherwise. The noinline directive keeps this sample function separate for the comparison. The machine is darwin/amd64 with Go 1.26.2. This illustrates the metadata question; it is not a test of Go 1.27, closure sharing or traceback labels.
//go:noinline
func privatePricingRule(n int) int { if n > 10 { return n * 7 }; return n * 9 }We built the same source twice and ran both artifacts. The linker documents -s as omitting the symbol table and debug information, and -w as omitting DWARF debug information; -s also implies -w. [4] These are build options, not encryption switches.
go build -o normal main.go
go build -ldflags='-s -w' -o stripped main.go
./normal
./strippedAn absent nm entry is not proof of absence
The normal build lists our function in nm; the stripped build does not. We then searched both files for the exact bytes of the name and found them in each. nm lists symbols, [5] but it is not a complete audit of everything readable in a file.
10a8500 T main.privatePricingRule
== exact function name in binary ==
normal: present
stripped: presentThe match establishes that this name appears in the file; by itself it does not identify its runtime structure or establish that every function name survives. Inlining, linking, target platform and build options can change the artifact. Renaming a function can reduce semantic clues, but does not make client-side logic secret.
go version -m showed go1.26.2 and command-line-arguments in both artifacts. Build information, symbols and runtime data are distinct surfaces to check. A reliable private debugging artifact also matters: a team reducing public information still needs to diagnose real crashes.
What to review when upgrading to Go 1.27
The release notes say the compiler generates simpler function-literal names and may share code among instances of the same literal when inlining. Tests that depend on closure symbol names may need updating. [2] Do not treat generated closure names as a stable interface or code-pointer equality as closure identity.
For modules with a go directive of 1.27 or later, traceback headers include runtime/pprof goroutine labels; GODEBUG=tracebacklabels=0 disables that behavior. [2] Labels can help diagnosis, but user IDs, tenant names and internal routes can also enter crash logs. pprof Do applies labels while a function runs. [6] Review label values and log recipients before deciding on the switch; it does not replace log access and retention controls.
On macOS, 1.27 requires macOS 13 Ventura or later. The linker adds -macos and -macsdk to set LC_BUILD_VERSION. [2] Compare the minimum with your supported users, inspect the final package’s load command, and re-sign, notarize and test after upgrading. A successful build alone does not show that an older OS remains supported.
Recommendations by case
These are engineering recommendations, not protection effects measured in our experiment. Identify who can receive the binary and logs before selecting checks and controls.
| Question | Finding |
|---|---|
| Names expose business meaning | Review names; put sensitive rules server-side when the feature permits. |
| Labels contain user or tenant data | Reduce label contents, restrict log access and consider disabling traceback labels. |
| macOS release | Check minimum version and load command; re-sign, notarize and test. |
| Tests depend on closure names | Test behavior instead of generated names. |
Moving a rule to a server adds network dependency and operating cost; offline features still need client-side execution. In either architecture, do not embed a shared privileged credential in the client and rely on stripping to protect it.
Check your own release build
Run the following against a final release artifact you are authorized to inspect, replacing the path and known function name. If nm returns no result, still inspect build information and known sensitive placeholders. Treat the output as internal material: it may contain paths or names.
go version -m path/to/your-app
go tool nm path/to/your-app | grep -F 'your.package.Function'
LC_ALL=C grep -aFq 'your.package.Function' path/to/your-app && echo present
# macOS: inspect the load command
otool -l path/to/your-app | grep -A5 LC_BUILD_VERSIONAlso find where the source sets pprof labels and inspect the real crash-upload path and its access controls. Record the toolchain, build flags and target platform. Rebuild and compare after an upgrade so configuration differences are not mistaken for version changes.
Your checklist
- Inspect function names and build information in the final binary.
- Inventory pprof labels and crash-log recipients.
- Evaluate tracebacklabels and test the diagnostic workflow.
- Confirm the macOS minimum, then re-sign, notarize and test.
- Replace tests of closure names with behavior checks.
Primary sources
- The Go Programming Language: Release History · Source date 2026-08-19 · Checked 2026-10-12
- The Go Programming Language: Go 1.27 Release Notes · Source date 2026-08-19 · Checked 2026-10-12
- GitHub: golang/go release go1.27.0 · Source date 2026-08-19 · Checked 2026-10-12
- Go linker documentation · Checked 2026-11-11
- Go nm documentation · Checked 2026-11-11
- Go runtime/pprof documentation · Checked 2026-11-11