Skip to main content

wasmgo

Go WebAssembly plugin for wasmrun.

About

wasmgo compiles Go projects to WebAssembly for wasmrun's Server Mode using TinyGo as the backend compiler, producing small WASM binaries suited to the browser.

Crates.io Version

Install

wasmrun plugin install wasmgo

Requirements:

  • Go toolchain
  • TinyGo compiler

Usage

Once installed, wasmrun auto-detects Go projects from go.mod:

# Compile and serve with the dev server
wasmrun ./my-go-project --watch

# Compile only
wasmrun compile ./my-go-project

# Plugin management
wasmrun plugin info wasmgo
wasmrun plugin update wasmgo

What It Covers

  • Go to WASM compilation through TinyGo
  • Flexible entry points: go.mod, main.go, cmd/main.go, and app.go layouts
  • Optimization options, including size-optimized builds
  • Live reload: watch mode recompilation through wasmrun's dev server
  • Compatibility checking and dependency validation before builds
  • Custom build targets

What It Doesn't Cover

  • Web application packaging: unlike wasmrust, there is no web app build pipeline
  • Standard go build output: compilation goes through TinyGo, so TinyGo's language coverage applies; packages relying on unsupported reflection or cgo won't compile
  • Running WASM: execution is handled by wasmrun, not the plugin

See Also