Lofigui Go WASM Example

Go compiled to WebAssembly running in your browser

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 Go WASM...

Loading WebAssembly module (typically <1 second)...

How It Works

  1. Compile Go to WASM: Go code is compiled to WebAssembly using GOOS=js GOARCH=wasm go build
  2. Load WASM Module: The browser loads the WASM binary (~2MB)
  3. Execute on Click: JavaScript calls Go functions exposed via js.Global()
  4. 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...