You build a compact Go microservice out of a couple dozen functions, check the file size of ./service before packing it into a container, and freeze: there's a binary sitting on disk taking up tens of megabytes. You didn't embed any images or pull in bloated SDKs, yet the final artifact weighs as much as a full-blown monolith.
Guessing from go.mod which package inflated the build won't get you far: the compiler packs the scheduler, garbage collector, and runtime lookup tables straight into the binary. As the Go Developer's Library channel reminded us, the built-in go tool nm utility from the standard toolchain lets you pinpoint the real culprits down to individual symbols.
How to Run go tool nm and Read a Binary's Symbol Map
Think of a compiled binary as a shipping container with a cargo manifest—a symbol table recording the address, weight, and storage category of every function, global variable, and constant table. By default, go tool nm prints only addresses, types, and names sorted alphabetically, so when inspecting a Go 1.27.3 service on darwin/arm64, I always pass two flags:
go tool nm -size -sort size ./service
# 1000a57c8 518624 R runtime.pclntab
# 100149c88 136152 R _type:*
# 1001241a8 131040 R go:func.*
The -size flag inserts the exact symbol size in decimal bytes (518624) between the hex address (1000a57c8) and the type (R), while -sort size ranks everything from largest to smallest. The letter in the third column tells you the segment: T (t) is executable function code, R (r) is immutable read-only data, D (d) is initialized variables, B (b) is the uninitialized bss segment, and U marks undefined external symbols with no address.
The biggest lines in a fresh Go binary aren't your T functions—they're immutable runtime lookup tables tagged with R.
Anatomy of Hidden Giants: Why pclntab and Type Metadata Outweigh Your Code
Where do hundreds of kilobytes in the R section come from? Peek into the runtime source at runtime/symtab.go. While running, the CPU only knows the current instruction address (Program Counter). To instantly print a stack trace with file names and line numbers during a panic, a runtime.Caller call, or pprof profiling, the compiler embeds the runtime.pclntab mapping table. In our build it weighs 518,624 bytes, eating 15–25% of a small binary. Right behind it come _type:* (136,152 bytes) and go:func.* (131,040 bytes)—type and function descriptors used for reflect, which even standard packages like fmt and encoding/json rely on.
You're probably wondering: "If I add up the numbers in the second column of nm, do I get the exact file size on disk? And what do I do when a buffer tagged B sits at the top?" You can't sum them directly. Symbol ranges can overlap, and the B (bss) section works like a "Reserved" sign on a restaurant table: an empty array reserves space in RAM at startup while taking up virtually zero bytes on disk.
A virtual buffer in the B segment doesn't bloat your container image, whereas R tables and T code cost you every single byte on disk.
That's why I use go tool nm as a compass for spotting unwanted dependencies, then verify the real savings by checking the rebuilt file size. Once the code is clean, pass go build -ldflags="-s -w" to the linker: those flags strip the symbol table and DWARF debug info, shrinking the binary by 20–40% while keeping runtime.pclntab intact for stack traces (I covered compiler improvements in our Go 1.27 release overview, and you can see the OS-level cost of static builds in GoNIX).
Open a terminal in your Go service directory right now, run go tool nm -size -sort size ./service | head -n 20, and see which R and T entries top your list.

