Interactive Demo
This page demonstrates running Go code compiled to WebAssembly in your browser. Go WASM is much smaller and faster than Pyodide!
Loading Go WASM module...
Output
Loading WebAssembly module (typically <1 second)...
How It Works
- Compile Go to WASM: Go code is compiled to WebAssembly using
GOOS=js GOARCH=wasm go build - Load WASM Module: The browser loads the WASM binary (~2MB)
- Execute on Click: JavaScript calls Go functions exposed via
js.Global() - Results Display: Go returns HTML strings that are displayed in the page
Benefits vs Pyodide
- 5x smaller: ~2MB vs ~10MB for Pyodide
- 10x faster startup: Instant vs 3-5 seconds
- Native performance: Compiled code, no interpreter
- Type-safe: Compile-time type checking
- Simpler deployment: Just .wasm + .html files
Trade-offs
- Requires build step (compile Go to WASM)
- Less dynamic than Python (statically typed)
- Smaller ecosystem than Python in browser
Go Source Code
The Go code running in your browser:
Loading...