Skip to content

eliben/watgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

334 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

watgo

CI pkg.go.dev


Logo

WebAssembly Toolkit for Go (watgo) to parse WASM text or decode WASM binary into internal data structures, allowing conversions, etc.

WASM feature support and proposals

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.

Installation

To install the CLI into your Go bin directory:

go install github.com/eliben/watgo/cmd/watgo@latest

To run it directly from a checkout without installing:

go run ./cmd/watgo

To run it straight from the module path without installing:

go run github.com/eliben/watgo/cmd/watgo@latest

Go API

The public Go API is documented on pkg.go.dev, including runnable examples for the high-level functions in package watgo.

Logo

CLI

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.wasm

For full command-line help, run:

watgo help

Testing

Run 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.

License

The source code of watgo is in the public domain. Certain vendored test scripts retain their original licenses: