wasmsize

command
v0.185.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command wasmsize says where the bytes of a Go WebAssembly binary go: the code of each package (or module), measured from the module's own code section, plus the data and the other sections.

It exists because `go tool nm` and `go version -m` both answer "unrecognized file format" for a .wasm, and the question came up for real: go-embedded-ruby's browser build was 102 MB (21.8 MB gzipped), six times the go-ndarray playground that wanted to embed it, and cutting it down needs to know which of its ~700 packages weigh what.

Function names come from the "name" custom section, which cmd/link writes unless -s is given. It writes them sanitized (every byte outside [0-9A-Za-z_.] becomes "_"), so a name cannot be split back into a package path; wasmsize matches it against the sanitized form of the build's package list instead, given with -deps (the output of `go list -deps` for the same GOOS/GOARCH and tags). Two paths that sanitize alike are reported, never guessed between.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL