On this page

Browser playground

The playground runs Pipit in a Web Worker on your device. Your source is not sent to the website server. Press Run or Ctrl/Cmd+Enter to load the runtime and execute the current file. Opening the page or restoring a draft does not execute code.

Loading and execution

The first run downloads a substantial WebAssembly runtime. Progress appears below the editor. The browser compiles the runtime while it downloads, and can reuse its compiled code on later visits. Browser caching depends on your settings and the runtime version.

Loading has a two-minute deadline. The manifest is limited to 4 KiB and selects only versioned local runtime paths; redirects are refused. WebAssembly content is limited to 64 MiB after decompression. These bounds do not guarantee browser memory usage or cancel an in-progress browser compilation, but a late compilation result is discarded after Stop or timeout.

Use Stop to cancel a download or terminate execution. Press Run again to create a new worker. The editor and navigation remain usable while code runs.

Trusted mode is for code you trust and terminates execution after five seconds. Restricted mode terminates after two seconds and uses Pipit's shared restricted policy. That policy allows the builtin print/println and reviewed math helpers, and denies other imports, goroutines and channels. The bundled examples target Trusted mode; examples importing fmt will be rejected in Restricted mode. Unknown modes fail instead of selecting Trusted mode.

These deadlines include compilation and execution after the worker is ready. Run, Format and the pkasm view accept at most 1 MiB of source and execute in the worker, not the page thread. Stop and the parent watchdog terminate the worker. These are browser controls, not hard memory isolation or guarantees made by the native CLI.

Runtime network requests are disabled by the worker's content security policy. Operating-system facilities may be unavailable even when a package or identifier appears in the browser registry.

Debugging

Click a line number to set a breakpoint, or press F9 to toggle one on the line with the cursor. Breakpoints are saved with your draft. Press Debug to run the file under Pipit's debugger. When it stops, the paused line is highlighted and the debug panel shows the call stack, variables and goroutines.

  • Continue (F8) runs to the next breakpoint.
  • Step over (F10) runs to the next line in the same function.
  • Step into (F11) enters the function called on this line.
  • Step out (Shift+F11) runs until the current function returns.
  • Stop ends the session.

Select a frame in the call stack to see its variables. Expand structs, maps and slices to see their contents. The watch box evaluates an expression in the selected frame; function calls are not allowed. The debugger also stops where a panic starts, before deferred functions run.

A breakpoint on a line with no code moves to the next line that has some; a hollow marker means the debugger could not place it. The editor is read-only while a session is active.

The five-second limit applies to each stretch of running code, not to the time you spend paused, so you can inspect a program for as long as you like. Pause only takes effect while the program is waiting, for example in time.Sleep or on a channel. The browser runs Pipit on a single thread, so only Stop can interrupt a busy loop. Debugging is available in Trusted mode only.

Compiled bytecode

Choose pkasm above the output to see the bytecode Pipit compiles your file to, as a pkasm listing. Compiling does not run the program, but the first time it loads the runtime, as Run does. The listing updates as you edit. Choose a ; main.go:N line to select that source line in the editor.

Each instruction shows its position, a dispatch marker, the opcode and its three operands. A marks an instruction handled in Pipit's assembly loop; S, X and G mark ways of calling out to Go. The listing is compiled as Trusted mode compiles it, and is clipped at 1 MiB.

Editing

  • Format applies Go formatting without running the source.
  • Reset restores the selected example after confirmation if you have edited it.
  • Download saves the current source as main.go.
  • Clear clears output without changing your source.
  • Enable Tab inserts indentation if you prefer editor-style indentation. It is off by default so Tab moves keyboard focus normally; Shift+Tab still moves focus backward.

Output is bounded and truncation is labelled. Compilation and execution errors appear in the output pane.

The page checks worker replies against the pending operation before displaying them. Malformed, unexpected, replayed or oversized replies stop the worker. These checks bound accepted output, not browser memory. Message transfer and WebAssembly allocation are still subject to the browser's own limits.

Local drafts

Edits and breakpoints are saved in this browser's local storage. A restored draft is never run automatically. Switching examples asks before replacing edited code. Clearing browser storage removes your draft. Private browsing or disabled storage may prevent saving, but editing and execution still work.

Do not treat local storage as a secure place for secrets. Download code you want to keep.

Compatibility

This is a single-file playground, not a complete Go development environment. See Compatibility and limits for the distinction between registered packages and supported behaviour.

If your browser does not support WebAssembly or Web Workers, use the CLI. A runtime loading error can be retried with Run.