Run Go code directly in your browser using WebAssembly, Yaegi, and the Monaco Editor (VS Code editor).
No backend. No server logic. Just Go + WASM.
This project is a client-side Go playground that lets you:
- Write Go code in a real code editor (Monaco / VS Code)
- Run the code instantly
- See output in a terminal-like panel
Everything runs inside the browser. Your code is interpreted locally. No data is sent to any server.
graph TD;
Browser[Browser HTML + JS] -->|Sends Code| WASM[Go Compiled to WebAssembly];
WASM -->|Executes| Yaegi[Yaegi Interpreter];
Yaegi -->|Interprets| User[User Go Code];
Yaegi -->|Returns Output| Browser;
- JavaScript collects Go code from the Monaco Editor.
- Go (compiled to WASM) receives the code.
- Yaegi interprets and executes the Go code.
- Output is sent back and displayed in the browser.
- Go syntax highlighting
- Line numbers & auto-indent
- Dark theme
- Auto-focus on load
- Ctrl + Enter / Cmd + Enter to run
- Same editor used by VS Code
- Runs fully in the browser (WASM)
- Real Go execution via Yaegi
- Real goroutines & channels (no fake scheduler)
- Supports goroutines, channels, maps, slices, functions
This is not the official Go Playground. By design:
- No networking (HTTP / TCP disabled)
- No file system access (WASM sandbox)
- No fake time acceleration (time.Sleep behaves normally)
These are browser + WASM limitations, not bugs.
.
├── main.go # Go → WASM + Yaegi interpreter
├── main.wasm # Compiled WebAssembly binary
├── index.html # UI + Monaco Editor + JS glue
├── style.css # Page styling
├── wasm_exec.js # Go WASM runtime (required)
├── go.mod # Go module & dependencies
└── README.md # This file
- Go 1.24+ (Required for latest WASM support)
- modern browser (Chrome, Firefox, Edge)
- A local web server (e.g., Python, Node, or serve)
If you are running this for the first time, download the required Yaegi packages:
go mod init go-browser-interpreter
go get [github.com/traefik/yaegi/interp](https://github.com/traefik/yaegi/interp)
go get [github.com/traefik/yaegi/stdlib](https://github.com/traefik/yaegi/stdlib)Compiles your Go code into a .wasm binary that the browser can understand.
GOOS=js GOARCH=wasm go build -o main.wasm main.goOptional (Optimization):
To reduce file size, strip debug information:
GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o main.wasm main.goYou must copy the JavaScript glue code provided by your Go installation. For Go 1.24+ / 1.25+:
cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" .(Note: If the above fails, try $(go env GOROOT)/misc/wasm/wasm_exec.js)
Then confirm:
ls -l wasm_exec.jsBrowsers will not load WASM files from the file system (file://) due to CORS security policies.
Using Python:
python3 -m http.server 8080Open in browser: http://localhost:8080
- Go Team — WebAssembly support
- Traefik Labs — Yaegi interpreter
- Microsoft — Monaco Editor