Repolode
Zxilly

Zxilly/go-size-analyzer

A command-line tool that breaks down the size of compiled Go binaries by package, section and symbol, with text, JSON, HTML, SVG, web and terminal UI output.

Stars
2,195
Forks
45
Open issues
9
Last commit
3 days ago

What is it?

go-size-analyzer answers the question of what makes a compiled Go binary large. It parses ELF, Mach-O, PE and experimental WebAssembly binaries and attributes their size to packages (including the standard library and vendored dependencies) and to binary sections such as .rodata, .gopclntab and DWARF debug data.

Results can be printed as a text table, exported as JSON, HTML, or SVG treemap, or explored interactively through a local web interface or a terminal UI. A diff mode compares two binaries or two saved JSON results, showing per-package and per-section growth, which is useful for tracking size changes between Go versions or builds.

The tool can also be run in the browser via a WebAssembly build, though it is noticeably slower there and is recommended only for smaller binaries. Analysis of stripped binaries works but may be less accurate.

Key features

  • 01Analyzes ELF, Mach-O, PE and experimental WebAssembly binaries.
  • 02Breaks down size by package, standard library, vendor dependency and section.
  • 03Outputs text, JSON, HTML and SVG treemap reports.
  • 04Provides an interactive web interface and a terminal UI.
  • 05Compares two binaries or saved JSON results in diff mode.

Use cases

  • Finding which dependencies inflate a Go service or CLI binary.
  • Tracking binary size changes between Go toolchain versions or commits.
  • Sharing an interactive size treemap of a build with teammates over a network.
  • Checking whether debug sections or symbols are a major part of a release binary.

Quick start

  1. 1

    Install with Go

    go install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest
  2. 2

    Start the web interface on a compiled Go binary

    gsa --web golang-compiled-binary

Things to know

  • Licensed under AGPL-3.0, a copyleft license that requires sharing modified source code when served over a network.
  • Building from source requires Go 1.27 or later.
  • Analysis of stripped binaries may be inaccurate.
  • The WebAssembly version in the browser is much slower than the native version.

In collections

Topics

#go#binary-analysis#bundle-size#visualization#cli#treemap#dependency-analysis#analyzer#binary#dependency

FAQ

What is go-size-analyzer?
A command-line tool that breaks down the size of compiled Go binaries by package, section and symbol, with text, JSON, HTML, SVG, web and terminal UI output. go-size-analyzer answers the question of what makes a compiled Go binary large. It parses ELF, Mach-O, PE and experimental WebAssembly binaries and attributes their size to packages (including the standard library and vendored dependencies) and to binary sections such as .rodata, .gopclntab and DWARF debug data.
Is go-size-analyzer free to use? What license does it have?
go-size-analyzer is open source under the AGPL-3.0 license. Check the license terms before using it in commercial products.
Is go-size-analyzer still maintained?
Actively maintained. The last commit to go-size-analyzer was on Nov 4, 2026.
What can I use go-size-analyzer for?
Finding which dependencies inflate a Go service or CLI binary. Tracking binary size changes between Go toolchain versions or commits. Sharing an interactive size treemap of a build with teammates over a network. Checking whether debug sections or symbols are a major part of a release binary.
How do I install go-size-analyzer?
Install with Go: go install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest Start the web interface on a compiled Go binary: gsa --web golang-compiled-binary
Where can I get go-size-analyzer?
The source code and installation instructions are on GitHub: https://github.com/Zxilly/go-size-analyzer

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects

A jq-like command-line tool and query language for inspecting and querying binary file formats, with decoders for dozens of formats.

Developer Tools#binary#cli#jq
10.6K+4 this week257GoOtherUpdated 2 days ago

Open-source macOS CLI (mo) for deep cleaning, app uninstalling, disk analysis, maintenance and live system status, with a separate native Mac app.

Developer Tools#macos#cli#disk-cleaner
74.1K+737 this week2.6KShellGPL-3.0Updated 23 hours ago