Go syntax. Erlang actors. Small enough for a microcontroller.
gogo is an actor VM for microcontrollers and a compiler for a subset of Go. You write a program as a set of isolated actors. Each one has its own heap and memory limit, they talk only by copied messages, and supervisors restart the ones that crash.
The VM is plain C99 with no third-party libraries.
- VM core
- under40KB
- idle actor
- ~150B
Actors
Isolation first. A crash stays where it happened.
Actors share nothing. A message is copied into the receiver's heap, so a misbehaving actor can run out of its own memory but not anyone else's. Links, monitors and supervisors work the way they do in Erlang: when an actor dies, the actors watching it are told why, and a supervisor starts a fresh one.
// a counter actor, and a call to it func counter() { total := 0 for { switch m := actor.Receive().(type) { case actor.Request: total += m.Body.(int) actor.Reply(m, total) } } } func main() { c := actor.Spawn(counter) r, _ := actor.Call(c, 5, 1000) println("total", r.(int)) }
Ports
Every peripheral is an actor you send messages to.
GPIO, the keyboard, files, sockets, the IMU, infrared, audio and the screen are ports: actors that take commands and send typed events back. A button press arrives in the mailbox like any other message. Byte ports, from TCP to the SD card, share one stream protocol.
On top of the ports sit libraries written in gogo itself: DHCP, DNS, HTTP and HTTPS, SNTP, a key-value store, a ring log, WAV playback and an ncurses-like text UI.
A subset of Go
Go's syntax and type checker. Actors where Go has goroutines.
A gogo program is Go source. The compiler parses it with Go's own parser and checks it with go/types, so a type error is found on your computer, never on the device. Then a second pass checks the subset: every feature it rejects comes with the gogo way to do it instead.
- types
- int8 .. uint64, float32, float64, bool, string, slices, arrays, maps, structs, pointers
- code
- functions, closures, methods, interfaces, embedding, type switches, labeled break and continue, range over int
- errors
- error values, panic, defer
- programs
- packages of your own, a GOGOPATH search, single-file programs and #! scripts
- library
- gogo/fmt, strings, strconv, errors, math, and the actor and device packages
What actors replace
The parts of Go that share memory between threads would break isolation, so the actor model takes their place.
- go f()
- actor.Spawn(f): a new actor with its own heap
- chan, select
- actor.Send and actor.Receive: copied messages to a mailbox
- recover()
- the actor ends and its supervisor starts a fresh one
- global state
- package-level variables are read-only, kept in flash; state lives in an actor
What is left out
Generics, goto, complex numbers, uintptr, init functions, pointers into a slice element or a field, and Go's standard packages by their Go paths. Reflection and a full runtime do not fit the memory budget. The compiler says so, and says what to write:
$ gogo build . main.gg:13:1: gogo: generic function not supported main.gg:21:8: gogo: channel not supported main.gg:22:2: gogo: go statement not supported main.gg:24:8: gogo: recover (a panic ends the actor: let its supervisor restart it) not supported main.gg:31:2: gogo: package-level variable counter is read-only
Small differences
- int
- 32 bits, on the board and on your computer; int64 when you need more
- maps
- range visits keys in order, the same order every time
- println
- prints structs, slices and the value inside an interface, where Go prints addresses
The full list, with workarounds, is in the book and the known-issues document.
One image, everywhere
Develop on your computer. Run the same bytes on the board.
The gogo tool compiles a directory of .gg files to one compact bytecode image, a .ggb file. The same image runs on the board, in the host VM on macOS and Linux, and inside other programs. An image names the drivers and mounts it needs, and older firmware refuses an image that uses something it lacks, instead of failing halfway.
- M5StickS3
- ESP32-S3, buttons, battery, IMU, IR send and receive, mic and speaker, Wi-Fi
- Cardputer ADV
- ESP32-S3, 56-key keyboard, SD card, IMU, IR send, mic and speaker, Wi-Fi
- host VM
- macOS and Linux, with simulated network, GPIO and microphone for tests
- embedded
- libgogo.a with one C header; a Go binding; the compiler as a C library
Modules load at run time: copy a .ggb to the board's flash and code.Load starts it, with no reflash and no reboot.
Architecture
Above the double line runs on your computer. Below it runs on the target.
YOUR COMPUTER
┌────────────────────────────────────────────────┐
│ program.gg + gogo/... standard library │
└────────────────────────┬───────────────────────┘
│ gogo build
▼
app.ggb one image for every target
═════════════════════════╪════════════════════════
TARGET ▼
┌────────────────────────┴───────────────────────┐
│ VM core C99, ~36 KB │
│ actors · scheduler · GC · messages · modules │
├────────────────────────────────────────────────┤
│ ports gpio · keys · files · tcp/tls · imu │
│ ir · audio · screen │
└────────────────────────┬───────────────────────┘
┌─────────────────┼─────────────────┐
▼ ▼ ▼
ESP32-S3 boards host VM libgogo.a
(FreeRTOS) (macOS, Linux) (in your app)
Programs import the standard library: its system packages compile to VM builtins, the rest is ordinary gogo code. The compiler turns both into one .ggb image. On the target, the VM core schedules actors and reaches every peripheral through ports, and the same core runs on the boards, in the host VM and inside other programs, each supplying its own host and board tables.
Size
Measured after every change.
- VM core
- about 36 KB of code, against a 64 KB budget
- idle actor
- about 150 bytes
- state
- all of it per VM; any number of VMs share one process
Distributed actors
Send to an actor on another board the way you send to one at home.
Boards join a server node over TCP. A remote PID is an ordinary PID: Send, Call, Monitor and Link work unchanged, and a node that goes away sends its watchers a DownMsg with the reason NoConnection. The server can be a computer, serving many boards.
$ gogo run nodehello client client: found counter <pid 4@1> added 1 total 1 added 2 total 3 ... the server stops ... server gone, reason 11
FAQ
Short answers. The full list is in the repository.
Is gogo Go?
No. Programs are written in a subset of Go syntax and checked by Go's own type checker, but they compile to gogo bytecode for gogo's actor VM, not to native code, and some Go features are not supported. That is why source files end in .gg and images in .ggb.
Is it compiled or interpreted?
Both, in two steps. gogo build compiles source ahead of time on your computer, so type errors are found before anything runs. The VM on the device interprets the bytecode. This is the model of Java or Erlang, not of Go or Python. The board never needs the compiler, and the same image runs everywhere.
How is it different from MicroPython?
MicroPython compiles on the device, gives you a REPL and has a large library and many boards. gogo compiles on your computer, catches type errors before the code ships, isolates each activity in an actor with its own heap, restarts what crashes, hot-loads modules without a restart, and keeps the VM core around 36 KB.
Is gogo an RTOS?
No. It runs on top of one. On the ESP32-S3 the VM is one FreeRTOS task, and gogovm is a normal macOS or Linux process. Inside, gogo has its own preemptive scheduler for actors, but not a real-time one: time-critical work stays in C drivers, which hand results to actors as messages.
Will there be a JIT?
Not planned. On the ESP32-S3 a JIT would need scarce executable RAM and an Xtensa code generator within the memory budget. If speed becomes a problem the plan is benchmarks first, then cheaper dispatch and more C builtins.
Is gogo vibe-coded AI slop?
Vibe-coded, yes. Slop, no. Most of the code was written by AI coding agents directed by its author. Every change is reviewed against a written plan by a separate pass, tested with golden tests, C unit tests, sanitizers and fuzzing, run on real boards, and held to a 64 KB VM budget. What does not work yet is written down.
Start
Two commands to a board, three from source.
# install gogo (macOS, Linux): picks your OS and CPU, checks SHA256SUMS $ curl -fsSL https://raw.githubusercontent.com/c4pt0r/gogo/main/install.sh | sh # a board over USB: identify, flash, set up Wi-Fi, run a first program $ gogo setup # from source: Go 1.27+, a C99 compiler, make $ make vm $ go build -o build/gogo ./cmd/gogo $ build/gogo run docs/book/examples/02-hello
The book, Programming gogo, walks through the language, the actors and every port, and every example in it is tested.