project · July 19, 2026 · 3 min read
babygo
Go by Example, run like rustlings: all 85 programs with the load-bearing lines cut out, a watcher that re-runs on save, and a checker that machine-verifies every single exercise.
babygo
When I learned Rust I loved rustlings: it hands you broken code and a compiler, and you are not done until the check passes. When I got to Go, the closest equivalent I found was golings — and honestly, it wasn’t very good. Meanwhile Go by Example is 85 complete, beautifully annotated programs that are excellent to read — but nothing is ever asked of you.
So I combined them. babygo is Go by Example with the load-bearing lines cut
out. You put them back. The runner is a small Go CLI called gorun:
1git clone https://github.com/krushiraj/babygo && cd babygo2make watch
make watch drops you into the first unsolved exercise and re-runs it every
time you save — with a diff of expected vs. actual output, the exact differing
characters highlighted, hints on demand, and single-key controls to re-run,
reset, or move on. It needs Go 1.26+ and nothing else: no dependencies, no
network after the clone.
All 85 are machine-checked
Exercises are checked by running them and diffing stdout — in Go by Example,
the output is the lesson. Where exact diffing can’t work, each exercise
declares a mode: regex for lines with timestamps or random values, test for
go test-driven exercises, unordered where Go’s map ordering shuffles lines.
The modes weren’t guessed — a capture command runs every solution ten times
and observes what actually varies.
I was stubborn about one thing: no “tick the box to say you did it” mode.
The design allowed for one, assuming exercises like http-server, tcp-server
and signals couldn’t be harness-driven — they block forever or want a second
terminal. Turns out they all can: httptest covers HTTP, a port-0 listener
with deadlines covers TCP, and signals sends itself the interrupt. An “I
promise I solved it” checkbox is exactly what a learner reaches for on the
exercises that would have taught them the most.
There’s also a make verify honesty check asserting the two things that
matter for all 85: every solution passes its own checker (the exercise is
solvable), and every shipped exercise fails it (there’s something to solve).
Not a fork
Go by Example isn’t forked — it’s cloned read-only, and the exercises are a
derived artifact recording the upstream hash they were cut from. A fork would
make every upstream merge conflict precisely where the lines were cut; instead
make sync just reports what moved upstream so exercises can be re-cut. All 85
programs and all of the teaching are Mark McGranaghan and Eli Bendersky’s Go
by Example (CC BY 3.0) — this project
only removes lines and adds a checker.
