A tool for analyzing the size of dependencies in compiled Golang binary files, providing insights into their impact on the final build.

Overview

gsv

Build and publish FOSSA Status

A simple tool to view the size of a Go compiled binary.

Build on top of bloaty.

Usage

First, you need to compile your Go program with the following flags:

 go build -gcflags=all="-N -l"

Then, you can use gsv to analyze the binary:

Analysis golang compiled binary size

Usage: gsv [OPTIONS] <BINARY>

Arguments:
  <BINARY>  The binary to analysis

Options:
  -p, --port <PORT>  The port to listen on for web mode [default: 8888]
  -w, --web          View the result in the browser
  -h, --help         Print help

Example

Web mode

$ gsv --web golang-compiled-binary

Will start a web server on port 8888, you can view the result in your browser.

The web page will look like this:

image

You can click the darker part to see the detail, and click the top bar to return to the previous level.

Text mode

$ gsv golang-compiled-binary
github.com/swaggo/files                             : 8.19MB
.gopclntab                                          : 6.80MB
Debug Section                                       : 6.34MB
github.com/spf13/cobra                              : 4.16MB
ariga.io/atlas/sql                                  : 1.40MB
C                                                   : 1.14MB
net/http                                            : 1.09MB
google.golang.org/protobuf/internal                 : 1.07MB
github.com/ZNotify/server                           : 1.03MB
golang.org/x/net                                    : 965.35KB

...[Collapsed]...

runtime/cgo                                         : 78.00B
internal/race                                       : 46.00B
.comment                                            : 43.00B
.note.gnu.build-id                                  : 36.00B
.note.gnu.property                                  : 32.00B
.interp                                             : 28.00B
.eh_frame_hdr                                       : 28.00B
.init                                               : 27.00B
.rela.plt                                           : 24.00B
.rela.dyn                                           : 24.00B
.fini_array                                         : 8.00B
.plt.got                                            : 8.00B
.init_array                                         : 8.00B
Total                                               : 55.08MB

Limitations

Since lots of workaround for static build is used, currently gsv only works on linux platform.

Constant string in Go binary is stored in .rodata section, analysis on this section depends on disassembler. Even if a constant is used by multiple packages within the program, the size of the constant will only be attributed to the package where it is first encountered during decompilation. This is a limitation of bloaty. For more information, please refer to this

As for now, gsv can only analyze elf64 binary. PE and Mach-O support will be added in the future.

Todo

  • Support PE and Mach-O
  • Support Windows and MacOS
  • Remove dependency on bloaty

You can find a pure rust version without dependency on bloaty at pure branch. Since it can not disassemble .rodata section, the result is not accurate. The work is still in progress.

Contribution

Any contribution is welcome, feel free to open an issue or a pull request.

LICENSE

Published under the MPL-2.0.

FOSSA Status

You might also like...
A tool to calculate mean and standard deviation from multiple tests using PageSpeed Insights API.

psi-sample PSI Test tool is an open source tool to assist web developers that runs Page Speed Insight test manually! Installing To install the psi-tes

A Rust trait to convert numbers of any type and size to their English representation.

num2english This Rust crate provides the NumberToEnglish trait which can be used to convert any* number to its string representation in English. It us

📊 Collect cloud usage data, so that it can be combined with impact data of Boavizta API.
📊 Collect cloud usage data, so that it can be combined with impact data of Boavizta API.

cloud-scanner Collect aws cloud usage data, so that it can be combined with impact data of Boavizta API. ⚠ Very early Work in progress ! At the moment

Ask questions, get insights from repos
Ask questions, get insights from repos

🍕 RepoQuery 🍕 A REST service to answer user-queries about public GitHub repositories 🔎 The Project RepoQuery is an early-beta project, that uses re

A CLI for analyzing the programming languages and how much code written in a project.
A CLI for analyzing the programming languages and how much code written in a project.

projlyzer A CLI for analyzing the programming languages and how much code written in a project. New features are on the way... Example Screenshot Buil

mollusc is a collection of pure-Rust libraries for parsing, interpreting, and analyzing LLVM.

mollusc is a collection of pure-Rust libraries for parsing, interpreting, and analyzing LLVM.

Rust package for constructing and analyzing phylogenies.

Rust-Phylogeny, a Rust library for phylogenetic trees Currently this library provides three algorithms: UPGMA and Neighbor-Joining for constructing a

FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension
FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension

FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension. With FileSorterX, you can easily keep your files organized and find what you need quickly.

crates is an extension aims to help people to manage their dependencies for rust (crates.io & TOML).
crates is an extension aims to help people to manage their dependencies for rust (crates.io & TOML).

crates Hello Rust & VSCode lovers, This is crates, an extension for crates.io dependencies. Aims helping developers to manage dependencies while using

An Intermediate Representation which can be compiled into WebAssembly

WebAssembly Intermediate Representation This is an Intermediate Representation which can be compiled into WebAssembly. The source code is in an experi

Rust+Cargo lightweight hello world with the most minimum binary size possible.

Lightweight Cargo Hello World Rust+Cargo lightweight hello world with the most minimum binary size possible. requirements 1: Rustup (Rustc, Cargo) Ins

🦀 How to minimize Rust binary size 📦

Minimizing Rust Binary Size To help this project reach more users, consider upvoting the min-sized-rust Stack Overflow answer. This repository demonst

Final Project for
Final Project for "Computer Networking Security": A Layer-3 VPN implementation over TLS

Final Project for "Computer Networking Security": A Layer-3 VPN implementation over TLS

C-like language compiler, the final project of ZJU Compiler Principle course
C-like language compiler, the final project of ZJU Compiler Principle course

cc99 cc99 (not cc98.org) is a C-like language compiler, which is the final project of ZJU Compiler Principle course. It supports many of the C99 langu

The (hopefully) final iteration of Luminol, written in Rust with love ❤️

Luminol Luminol is an experimental remake of the RGSS RPG Maker editors in Rust with love ❤️ . Luminol targets wasm and native builds with eframe. Lum

Grebuloff is an experimental addon framework for Final Fantasy XIV.

Grebuloff Grebuloff is an experimental addon framework for Final Fantasy XIV. It introduces a new concept of what plugins can be, focusing on enabling

Parse byte size into integer accurately.

parse-size parse-size is an accurate, customizable, allocation-free library for parsing byte size into integer. use parse_size::parse_size; assert_eq

Split text into semantic chunks, up to a desired chunk size. Supports calculating length by characters and tokens

Large language models (LLMs) can be used for many tasks, but often have a limited context size that can be smaller than documents you might want to use. To use documents of larger length, you often have to split your text into chunks to fit within this context size.

Difftastic is an experimental structured diff tool that compares files based on their syntax.
Difftastic is an experimental structured diff tool that compares files based on their syntax.

Difftastic is an experimental structured diff tool that compares files based on their syntax.

Comments
Releases(0.1.0)
Owner
null
ergonomic paths and files in rust

path_abs: ergonomic paths and files in rust. This library aims to provide ergonomic path and file operations to rust with reasonable performance. See

Rett Berg 45 Oct 29, 2022
Find files with SQL-like queries

Find files with SQL-like queries

null 3.4k Dec 29, 2022
fftp is the "Fast File Transport Protocol". It transfers files quickly between computers on a network with low overhead.

fftp fftp is the "Fast File Transport Protocol". It transfers files quickly between computers on a network with low overhead. Motivation FTP uses two

leo 4 May 12, 2022
Collects accurate files while running in parallel through directories. (Simple, Fast, Powerful)

collectfiles Collects accurate files while running in parallel through directories. (Simple, Fast, Powerful) | Docs | Latest Note | [dependencies] col

Doha Lee 2 Jun 1, 2022
Merge together and efficiently time-sort compressed .pcap files stored in AWS S3 object storage (or locally) to stdout for pipelined processing.

Merge together and efficiently time-sort compressed .pcap files stored in AWS S3 object storage (or locally) to stdout for pipelined processing. High performance and parallel implementation for > 10 Gbps playback throughput with large numbers of files (~4k).

null 4 Aug 19, 2022
ezio offers an easy to use IO API for reading and writing to files and stdio

ezio - a crate for easy IO ezio offers an easy to use IO API for reading and writing to files and stdio. ezio includes utilities for generating random

Nick Cameron 98 Dec 21, 2022
Rustronomy-fits - a Rustronomy tool for FITS file I/O

Rustronomy-fits - a Rustronomy tool for FITS file I/O Rustronomy-fits provides I/O tools for reading, writing and parsing FITS files. It is currently

Raúl 3 Dec 8, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
A Rust port of the command line program playing with the cutscenes files (USM) from Genshin Impact.

GI-cutscenes : Rust Remix A command line program playing with the cutscene files (USM) from Genshin Impact, reimplemented in Rust. Much like its origi

Lymkwi 5 Nov 6, 2022