WebAssembly Toolkit for Go (watgo) to parse WASM text or decode WASM binary into internal data structures, allowing conversions, etc.
Initially, we aim to support all the finished proposals without any flags or feature selection. Finished proposals are part of the WASM spec.
If there's a request to support active proposals, we'll consider employing explicit feature flags to gate this support.
To install the CLI into your Go bin directory:
go install github.com/eliben/watgo/cmd/watgo@latestTo run it directly from a checkout without installing:
go run ./cmd/watgoTo run it straight from the module path without installing:
go run github.com/eliben/watgo/cmd/watgo@latestThe public Go API is documented on pkg.go.dev,
including runnable examples for the high-level functions in package watgo.
watgo currently provides basic parse and validate subcommands.
For supported subcommands and flags, the CLI aims to stay compatible with
wasm-tools.
Examples:
# Compile WAT text to a WASM binary file.
watgo parse input.wat -o output.wasm
# Validate a WAT file.
watgo validate input.wat
# Validate a WASM binary.
watgo validate input.wasm
# Read WAT from stdin and write WASM to stdout.
cat input.wat | watgo parse > output.wasmFor full command-line help, run:
watgo helpRun the full test suite with:
go test ./...Some of the end-to-end tests execute compiled modules under Node.js, so Node is required for the full suite.
For more detail on the different test sets and how to refresh them from
upstream, see tests/README.md.
The source code of watgo is in the public domain. Certain vendored test scripts retain their original licenses:
-
tests/wasmspec- Source: https://github.com/WebAssembly/spec/
- License: Apache License 2.0
- See:
tests/wasmspec/LICENSE
-
tests/wabt-interp- Source: https://github.com/WebAssembly/wabt
- License: Apache License 2.0
- See:
tests/wabt-interp/LICENSE

