Help us shape the future of Go! Take the 2026 Go Developer Survey

wasmsize

command
v0.62.0 Latest Latest
Warning

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

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

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