Skip to content

SYSTEM Cited by 1 source

go-size-analyzer

go-size-analyzer (github.com/Zxilly/go-size-analyzer) is an OSS tool that reads a built Go binary and reports the byte cost of each dependency. Text output for CLI use, interactive web UI for drill-down (hover a tile for the exact size).

Why it matters

A package's size impact is not determined by whether you imported it — it's determined by which of its symbols end up reachable after the linker's dead-code elimination pass. Two packages with identical source can contribute wildly different byte amounts depending on how the importer uses them, whether init functions force global- variable initialization, or whether reflect.MethodByName pessimises method DCE across the whole binary.

This means go list-based dep counts can be misleading for size engineering. go-size-analyzer looks at what actually stays in the binary, making it the right tool to pick targets.

Example output

From the 2026-02-18 Datadog post, analysis of the trace-agent binary before the k8s-split fix:

| PERCENT | NAME                                  | SIZE   | TYPE    |
|---------|---------------------------------------|--------|---------|
| 21.48%  | k8s.io/api                            | 14 MB  | vendor  |
| 18.63%  | .rodata                               | 12 MB  | section |
| 15.69%  | k8s.io/client-go                      | 9.9 MB | vendor  |
|  4.48%  | github.com/DataDog/datadog-agent      | 2.8 MB | main    |
|  2.50%  | k8s.io/apimachinery                   | 1.6 MB | vendor  |

≥30 MiB of k8s vendor code in a binary that's supposed to be Kubernetes-free — the motivating trigger for the package-split fix that removed 570 packages.

Complementary tools

  • go list — set of packages in the binary (what).
  • systems/goda — why each package was imported (why).
  • go-size-analyzer — byte cost per package (how much).

Seen in

Last updated · 200 distilled / 1,178 read