HeadlinesBriefing favicon HeadlinesBriefing.com

watgo launches pure‑Go WebAssembly toolkit

Hacker News •
×

Developer Eliben released watgo, a pure‑Go WebAssembly toolkit that mirrors the functionality of C++ wabt and Rust wasm‑tools but without external dependencies. The package ships a command‑line interface and a Go API capable of parsing WAT text, validating modules against official semantics, and converting to or from binary WASM. Its core representation, wasmir, exposes a semantic model for inspection and manipulation for both tooling and runtime scenarios.

Installation is a single go install command, making watgo drop‑in compatible with existing wasm‑tools scripts. A sample CLI call—`watgo parse stack.wat -o stack.wasm`—demonstrates end‑to‑end parsing, validation, and encoding. The Go API lets developers iterate over functions, count i32 parameters, and tally instruction types, as shown in a concise example that prints module statistics and can be scripted in CI pipelines.

Watgo’s reliability stems from leveraging the official WebAssembly test suite, which contains roughly 200K lines of WAT files covering correct execution and error handling. A custom harness converts .wast modules to WASM and runs them under Node.js, achieving full pass of the core spec. By matching wasm‑tools’ CLI and offering a Go‑native API, watgo simplifies integration of WebAssembly into Go projects.