Write Go in the browser and run it in seconds. Each run is compiled in its own Docker container with time and memory limits, and the output streams into a console as the program prints it.
- Year
- 2024
- Role
- design, backend, frontend
- Status
- live
- The editor with the output console on the right
- Running the Fibonacci example
- Example programs to get started
- The same editor on a phone
Overview
Write Go in the browser, hit run, and watch the output stream back into a console. The ACE editor handles syntax highlighting and indentation, and a format button runs gofmt on your snippet so it always looks like idiomatic Go.
Every run is compiled and executed inside a short-lived Docker container with strict time and memory limits, so arbitrary code can be tried safely. Each session gets its own container, so users never interfere with each other.
I built it to have a scratchpad I could open from any machine while learning the language, and it has since become my default place to test small ideas before they land in a real project.
Features
-
Online editor
ACE editor with a Go mode, two themes and keyboard shortcuts for run and format.
-
Sandboxed execution
Each run happens in an isolated Docker container with CPU, memory and time limits.
-
Real-time output
Standard output and errors are streamed to the console as the program produces them.
-
Interactive input
Programs that read from stdin get their input from a dedicated field.
-
Formatting
One click runs gofmt and replaces the editor content with the formatted code.
-
Examples
A set of example programs and a short tutorial to get started with the language.
Under the hood
- The frontend posts the code to the Go server, which is built on the standard library and the chi router.
- The server writes the snippet into a per-session Docker container and runs it with resource limits.
- Output is read from the container and streamed back to the browser as it is produced.
- Containers are reaped when the session ends or the time limit is hit, so nothing lingers on the host.
Built with
- Go
- chi
- Docker
- ACE editor
- JavaScript
What I learned
- Running untrusted code safely is mostly about limits: CPU, memory, time, network and filesystem.
- Streaming output instead of buffering it changes how the tool feels, even for programs that finish in milliseconds.
- Keeping the frontend to one page with no framework made it easy to come back to months later.