{"id":16588010,"url":"https://github.com/zxilly/go-size-analyzer","last_synced_at":"2026-04-12T08:12:55.533Z","repository":{"id":106876523,"uuid":"609147387","full_name":"Zxilly/go-size-analyzer","owner":"Zxilly","description":"A tool for analyzing the size of compiled Go binaries, offering cross-platform support, detailed breakdowns, and multiple output formats.","archived":false,"fork":false,"pushed_at":"2025-03-31T19:12:43.000Z","size":3960,"stargazers_count":1505,"open_issues_count":7,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T20:24:55.204Z","etag":null,"topics":["analyzer","binary","dependency","go","golang","react","symbol","terminal-ui","treemap","typescript","visualization"],"latest_commit_sha":null,"homepage":"https://gsa.zxilly.dev/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zxilly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-03T13:29:28.000Z","updated_at":"2025-03-31T19:12:47.000Z","dependencies_parsed_at":"2024-03-25T18:11:10.450Z","dependency_job_id":"12acaa10-314a-4970-ab13-4dca94dc87db","html_url":"https://github.com/Zxilly/go-size-analyzer","commit_stats":{"total_commits":1015,"total_committers":10,"mean_commits":101.5,"dds":"0.22660098522167482","last_synced_commit":"9ed232e00b3496712caa891b24c0b181000b1bc1"},"previous_names":["zxilly/go-size-view"],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zxilly%2Fgo-size-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zxilly%2Fgo-size-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zxilly%2Fgo-size-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zxilly%2Fgo-size-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zxilly","download_url":"https://codeload.github.com/Zxilly/go-size-analyzer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248326129,"owners_count":21085042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analyzer","binary","dependency","go","golang","react","symbol","terminal-ui","treemap","typescript","visualization"],"created_at":"2024-10-11T22:55:37.291Z","updated_at":"2026-04-02T18:21:00.037Z","avatar_url":"https://github.com/Zxilly.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-size-analyzer\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/Zxilly/go-size-analyzer)](https://goreportcard.com/report/github.com/Zxilly/go-size-analyzer)\n[![Tests](https://github.com/Zxilly/go-size-analyzer/actions/workflows/built-tests.yml/badge.svg)](https://github.com/Zxilly/go-size-analyzer/actions/workflows/built-tests.yml)\n[![Codecov](https://img.shields.io/codecov/c/gh/Zxilly/go-size-analyzer)](https://codecov.io/github/Zxilly/go-size-analyzer)\n[![GitHub release](https://img.shields.io/github/v/release/Zxilly/go-size-analyzer)](https://github.com/Zxilly/go-size-analyzer/releases)\n[![go-recipes](https://raw.githubusercontent.com/nikolaydubina/go-recipes/main/badge.svg?raw=true)](https://github.com/nikolaydubina/go-recipes?tab=readme-ov-file#-visualise-dependencies-size-in-compiled-binaries-with-go-size-analyzer)\n[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Zxilly/go-size-analyzer/badge)](https://scorecard.dev/viewer/?uri=github.com/Zxilly/go-size-analyzer)\n\nEnglish | [简体中文](./README_zh_CN.md)\n\nA simple tool to analyze the size of a Go compiled binary.\n\n- [x] Cross-platform support for analyzing `ELF`, `Mach-O`, `PE` and `WebAssembly (experimental)` binary formats\n- [x] Detailed size breakdown by packages and sections\n- [x] Support multiple output formats: `text`, `json`, `html`, `svg`\n- [x] Interactive exploration via web interface and terminal UI\n- [x] Binary comparison with diff mode (supports `json` and `text` output)\n\n## Installation\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/go-size-analyzer.svg)](https://repology.org/project/go-size-analyzer/versions)\n\n### [Download the latest binary](https://github.com/Zxilly/go-size-analyzer/releases)\n\n### MacOS / Linux via Homebrew:\n\nUsing [Homebrew](https://brew.sh/)\n```\nbrew install go-size-analyzer\n```\n\n### Windows:\n\nUsing [scoop](https://scoop.sh/)\n```\nscoop install go-size-analyzer\n```\n\n### Go Install:\n```\ngo install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest\n```\n\n## Usage\n\n### Example\n\n#### Web mode\n\n```bash\n$ gsa --web golang-compiled-binary\n```\n\nWill start a web server on port 8080, you can view the result in your browser.\n\nOr you can use the WebAssembly version in the browser: [GSA Treemap](https://gsa.zxilly.dev)\n\n\u003e [!NOTE]  \n\u003e Due to the limitation of the browser, the WebAssembly version is much slower than the native version.\n\u003e Normally costs 10x time to analyze the same binary.\n\u003e \n\u003e Only recommended for analysing small applications (less than 30 MB in size)\n\nThe web page will look like this:\n\n![image](https://github.com/Zxilly/go-size-analyzer/assets/31370133/e69583ce-b189-4a0d-b108-c3b7d5c33a82)\n\nYou can click to expand the package to see the details.\n\n#### Terminal UI\n\n```bash\n$ gsa --tui golang-compiled-binary\n```\n\n[![asciicast](https://asciinema.org/a/670664.svg)](https://asciinema.org/a/670664)\n\n#### Text mode \n\n```bash\n$ gsa docker-compose-linux-x86_64\n┌─────────────────────────────────────────────────────────────────────────────────┐\n│ docker-compose-linux-x86_64                                                     │\n├─────────┬──────────────────────────────────────────────────┬────────┬───────────┤\n│ PERCENT │ NAME                                             │ SIZE   │ TYPE      │\n├─────────┼──────────────────────────────────────────────────┼────────┼───────────┤\n│ 17.37%  │ k8s.io/api                                       │ 11 MB  │ vendor    │\n│ 15.52%  │ .rodata                                          │ 9.8 MB │ section   │\n│ 8.92%   │ .gopclntab                                       │ 5.6 MB │ section   │\n│ 7.51%   │ .strtab                                          │ 4.7 MB │ section   │\n│ 5.13%   │ k8s.io/client-go                                 │ 3.2 MB │ vendor    │\n│ 3.36%   │ .symtab                                          │ 2.1 MB │ section   │\n│ 3.29%   │ github.com/moby/buildkit                         │ 2.1 MB │ vendor    │\n│ 2.02%   │ google.golang.org/protobuf                       │ 1.3 MB │ vendor    │\n│ 1.96%   │ github.com/google/gnostic-models                 │ 1.2 MB │ vendor    │\n│ 1.82%   │ k8s.io/apimachinery                              │ 1.1 MB │ vendor    │\n│ 1.73%   │ net                                              │ 1.1 MB │ std       │\n│ 1.72%   │ github.com/aws/aws-sdk-go-v2                     │ 1.1 MB │ vendor    │\n│ 1.57%   │ crypto                                           │ 991 kB │ std       │\n│ 1.53%   │ github.com/docker/compose/v2                     │ 964 kB │ vendor    │\n│ 1.48%   │ github.com/gogo/protobuf                         │ 931 kB │ vendor    │\n│ 1.40%   │ runtime                                          │ 884 kB │ std       │\n│ 1.32%   │ go.opentelemetry.io/otel                         │ 833 kB │ vendor    │\n│ 1.28%   │ .text                                            │ 809 kB │ section   │\n│ 1.18%   │ google.golang.org/grpc                           │ 742 kB │ vendor    │\n\n...[Collapsed]...\n\n│ 0.00%   │ github.com/google/shlex                          │ 0 B    │ vendor    │\n│ 0.00%   │ github.com/pmezard/go-difflib                    │ 0 B    │ vendor    │\n│ 0.00%   │ go.uber.org/mock                                 │ 0 B    │ vendor    │\n│ 0.00%   │ github.com/kballard/go-shellquote                │ 0 B    │ vendor    │\n│ 0.00%   │ tags.cncf.io/container-device-interface          │ 0 B    │ vendor    │\n│ 0.00%   │ github.com/josharian/intern                      │ 0 B    │ vendor    │\n│ 0.00%   │ github.com/shibumi/go-pathspec                   │ 0 B    │ vendor    │\n│ 0.00%   │ dario.cat/mergo                                  │ 0 B    │ vendor    │\n│ 0.00%   │ github.com/mattn/go-colorable                    │ 0 B    │ vendor    │\n│ 0.00%   │ github.com/secure-systems-lab/go-securesystemslib│ 0 B    │ vendor    │\n├─────────┼──────────────────────────────────────────────────┼────────┼───────────┤\n│ 100%    │ KNOWN                                            │ 63 MB  │           │\n│ 100%    │ TOTAL                                            │ 63 MB  │           │\n└─────────┴──────────────────────────────────────────────────┴────────┴───────────┘\n\n```\n\n#### Diff Mode\n\n```bash\n$ gsa bin-linux-1.21-amd64 bin-linux-1.22-amd64\n┌────────────────────────────────────────────────────────────────┐\n│ Diff between bin-linux-1.21-amd64 and bin-linux-1.22-amd64     │\n├─────────┬──────────────────────┬──────────┬──────────┬─────────┤\n│ PERCENT │ NAME                 │ OLD SIZE │ NEW SIZE │ DIFF    │\n├─────────┼──────────────────────┼──────────┼──────────┼─────────┤\n│ +28.69% │ runtime              │ 801 kB   │ 1.0 MB   │ +230 kB │\n│ +100%   │ internal/chacha8rand │          │ 3.1 kB   │ +3.1 kB │\n│ +5.70%  │ \u003cautogenerated\u003e      │ 18 kB    │ 19 kB    │ +1.0 kB │\n│ +8.59%  │ internal/abi         │ 6.1 kB   │ 6.6 kB   │ +525 B  │\n│ +10.52% │ internal/cpu         │ 4.9 kB   │ 5.4 kB   │ +515 B  │\n│ +4.45%  │ internal/reflectlite │ 3.9 kB   │ 4.1 kB   │ +173 B  │\n│ +2.64%  │ internal/bytealg     │ 1.5 kB   │ 1.5 kB   │ +39 B   │\n│ +0.80%  │ strconv              │ 4.0 kB   │ 4.0 kB   │ +32 B   │\n│ +0.19%  │ syscall              │ 13 kB    │ 13 kB    │ +24 B   │\n│ -0.37%  │ embed                │ 8.6 kB   │ 8.6 kB   │ -32 B   │\n│ -0.16%  │ main                 │ 19 kB    │ 19 kB    │ -32 B   │\n│ -0.38%  │ reflect              │ 25 kB    │ 25 kB    │ -96 B   │\n│ -0.26%  │ time                 │ 87 kB    │ 87 kB    │ -224 B  │\n│ -7.95%  │ sync                 │ 9.5 kB   │ 8.7 kB   │ -755 B  │\n├─────────┼──────────────────────┼──────────┼──────────┼─────────┤\n│ +8.47%  │ .rodata              │ 122 kB   │ 132 kB   │ +10 kB  │\n│ +5.04%  │ .gopclntab           │ 144 kB   │ 152 kB   │ +7.3 kB │\n│ +3.61%  │ .debug_info          │ 168 kB   │ 174 kB   │ +6.1 kB │\n│ +3.52%  │ .debug_loc           │ 81 kB    │ 84 kB    │ +2.9 kB │\n│ +3.03%  │ .debug_line          │ 80 kB    │ 82 kB    │ +2.4 kB │\n│ +3.41%  │ .symtab              │ 59 kB    │ 61 kB    │ +2.0 kB │\n│ +4.29%  │ .debug_frame         │ 29 kB    │ 30 kB    │ +1.2 kB │\n│ +1.25%  │ .strtab              │ 61 kB    │ 62 kB    │ +763 B  │\n│ +3.28%  │ .debug_ranges        │ 13 kB    │ 13 kB    │ +415 B  │\n│ +5.13%  │ .data                │ 5.0 kB   │ 5.2 kB   │ +256 B  │\n│ +7.32%  │ .typelink            │ 1.3 kB   │ 1.3 kB   │ +92 B   │\n│ +27.78% │ .go.buildinfo        │ 288 B    │ 368 B    │ +80 B   │\n│ -1.56%  │ .debug_gdb_scripts   │ 64 B     │ 63 B     │ -1 B    │\n│ -0.63%  │ .noptrdata           │ 2.5 kB   │ 2.5 kB   │ -16 B   │\n├─────────┼──────────────────────┼──────────┼──────────┼─────────┤\n│ +3.86%  │ bin-linux-1.21-amd64 │ 1.6 MB   │ 1.6 MB   │ +61 kB  │\n│         │ bin-linux-1.22-amd64 │          │          │         │\n└─────────┴──────────────────────┴──────────┴──────────┴─────────┘\n```\n\n#### Svg Mode\n\n```bash\n$ gsa cockroach-darwin-amd64 -f svg -o data.svg --hide-sections\n```\n\n![image](./assets/example.svg)\n\n### Full options\n\n```bash\nA tool for determining the extent to which dependencies contribute to the\nbloated size of compiled Go binaries.\n\nArguments:\n  \u003cfile\u003e           Binary file to analyze or result json file for diff\n  [\u003cdiff file\u003e]    New binary file or result json file to compare, optional\n\nFlags:\n  -h, --help             Show context-sensitive help.\n      --verbose          Verbose output\n  -f, --format=\"text\"    Output format, possible values: text,json,html,svg\n      --no-disasm        Skip disassembly pass\n      --no-symbol        Skip symbol pass\n      --no-dwarf         Skip dwarf pass\n  -o, --output=STRING    Write to file\n      --version          Show version\n\nText output options\n  --hide-sections    Hide sections\n  --hide-main        Hide main package\n  --hide-std         Hide standard library\n\nJson output options\n  --indent=INDENT    Indentation for json output\n  --compact          Hide function details, replacement with size\n\nSvg output options\n  --width=1028         Width of the svg treemap\n  --height=640         Height of the svg treemap\n  --margin-box=4       Margin between boxes\n  --padding-box=4      Padding between box border and content\n  --padding-root=32    Padding around root content\n\nWeb interface options\n  --web               use web interface to explore the details\n  --listen=\":8080\"    listen address\n  --open              Open browser\n  --update-cache      Update the cache file for the web UI\n\nTerminal interface options\n  --tui    Use terminal interface to explore the details\n\nImports analysis options\n  --imports    Try analyze package imports from source\n\n```\n\n\u003e [!CAUTION]\n\u003e\n\u003e The tool can work with stripped binaries, but it may lead to inaccurate results.\n\n## TODO\n\n- [ ] Add more pattern for disassembling the binary\n- [x] Extract the information from the DWARF section\n- [x] Count the symbol size itself to package\n- [ ] Add other charts like flame graph, pie chart, etc.\n- [ ] Support C++/Rust symbol demangling in cgo\n- [x] Add a TUI mode for exploring details\n- [x] Compile to wasm, create a ui to analyze the binary in the browser\n\n## Contribution\n\nAny contribution is welcome, feel free to open an issue or a pull request.\n\nFor development, see the [Development Guide](./DEVELOPMENT.md) for more details.\n\n## LICENSE\n\nPublished under the [AGPL-3.0](./LICENSE).\n\n### Supported by\n\n[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxilly%2Fgo-size-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzxilly%2Fgo-size-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxilly%2Fgo-size-analyzer/lists"}