Enough Go to Read These Builds a show in 8 chapters
Goal: read the 10 real build lines the lesson lists
1 of 8 Your guess
Before we start
This track builds seven real systems from an empty file, all in the Go language. A server is the first thing most of them become: one program answering many visitors at once.
Picture that server as a kitchen with many tables. Which picture is closest to how a Go server copes?
Pick the closest. You find out which fits at the end.
2 of 8 The problem
2007: a 45-minute build
In 2007, one major Google program, written in the C++ language, took 45 minutes to build. That was on a build system spread over many machines.
Rob Pike told the story in a 2012 talk, and called what came next a myth: that Go was dreamed up during one of those 45-minute builds.
The date is not a myth. On 21 September 2007, Robert Griesemer, Rob Pike and Ken Thompson started sketching a new language on a whiteboard at Google.
Three goals: it builds in seconds, it reads plainly to someone who has never seen the file, and it is made for machines serving many people at once. Go went public on 10 November 2009.
That last goal is why these builds are in Go. A server is a kitchen: orders come in from many tables at once, cooks work them, and a shared sheet on the counter gets read and written by everyone.
Each piece of that kitchen turns out to be one Go word. There are five, and the next four chapters act each one out.
The track builds seven systems: a memory store like Redis, a message log, a web server, a database, a job scheduler, a small Kubernetes and a store spread over several machines.
Your goal: read the 10 real lines the lesson lists from those builds. Each one gets acted out on a drawing, one line at a time.
No Go assumed. If you know a program runs its steps top to bottom, that is enough.
counted with a text search over the seven builds, on 2026-09-28
3 of 8 The idea
The slip and the note
In many languages a failure makes the program jump somewhere else to complain. Go does not. A cook hands you a plate and a slip. If the slip is blank, eat. If it says "no gas", do not eat the plate.
Press Play. The Redis build's very first line, acted out one piece at a time.
The slip is an error: an ordinary value, like a number. You look at it on the very next line.
Now a slip with something on it. The lesson's first program turns text into a port number, the door a server listens at, three times.
Press Play. The lesson's first program turns text into a port number three times, and two of the three fail.
That check, if err != nil, is the most common line in these builds. Read it as "plate and slip, check the slip".
The seven builds check the slip 92 times. Once you read it that way, all 92 read themselves.
A cook who opens the fridge must close it, whether the order went well, went badly or was abandoned halfway. So what if "close" is simply the last step?
Press Play. This version writes close at the bottom, the way you might first try it. It is not the lesson's code: it shows what defer saves you from.
Go's answer is one word, written right after you open the thing.
Press Play. The lesson's real serve: one word, defer, moves close off the path and onto the door.
defer keeps the cleanup beside the mess it cleans. The builds use it twice: closing a connection, and handing back a key you meet in chapter 6.
4 of 8 The idea
Three shapes
Data in these builds takes three shapes. The first one finds a value by its name, the way you find a jar on a shelf by its label.
Press Play. The lesson's second program keeps the kitchen's stock in a map.
A shelf of values found by name is a map.
The second bundles a few named things into one, the way a ticket carries a table, a dish and how many.
Press Play. A ticket in the lesson's kitchen, built one field at a time.
A card of named fields is a struct. A function that belongs to one is a method.
The third is a list that grows. Four tickets reach the kitchen's Cook method. Watch the map shrink and the list grow.
Press Play. Four tickets through Cook, one line at a time. Watch the map shrink and the slice grow.
A list that grows with append is a slice. Here it grew from 0 tickets to 2.
What changed
- Tickets in the slice: 0 → 2
Why = here, and := before?
:= makes new boxes and fills them. = puts a new value into a box that already exists, like the dal jar.
The database build's fourth stage splits a full list of keys in two, with one line.
Press Play. The database build's fourth stage splits a full list of keys in two with one line.
100,000 ÷ 78 ms ≈ 1,282 goroutines started every millisecondmeasured with go run ./03-goroutines on a laptop, 2026-09-28
var sem = make(chan struct{}, 100)a rail of 100 hooks for blank tickets: at most 100 visitors in flight
real line · http/06-concurrent/main.go, line 23
5 of 8 Try it
A cook per visitor
Now the kitchen gets busy. Each visitor to the Redis build is a connection, an open line from their computer.
Press Play. The first Redis stage serves one visitor at a time, on purpose.
The kitchen needs a cook for Bob. In Go that is one word in front of a function call.
Press Play. The fix in the Redis build's fourth stage is one word, go.
A function started with go, running alongside the rest, is a goroutine. The Redis build and the web server build both start one per visitor.
Here the kitchen stops matching. A cook is a person you pay. A goroutine is so cheap that the lesson's program starts 100,000 of them in 78 milliseconds. Three more runs: 83, 68, 93.
Go runs all of them on a handful of real processor cores, the parts of the chip that actually run steps, switching whenever one is waiting.
How do orders reach the cooks? A ticket rail: a bar with a fixed number of hooks. The waiter clips a ticket on, a free cook pulls one off.
Press Play. The lesson's third program: 12 tickets, a rail of 4 hooks, 3 cooks. Small teaching numbers, to follow by eye. How long each dish takes is a made-up sim, the same every run.
Go's built-in rail is a channel. Sending waits when it is full, taking waits when it is empty.
The web server build uses a channel for exactly the "waits when full" half: as a limit on how many visitors it serves at once.
Press Play. The web server build uses a rail only for its waiting. struct{} is Go's empty value: a ticket with nothing written on it.
4 cooks × 100,000 = 400,000 marks expected400,000 − 195,493 = 204,507 lost204,507 ÷ 400,000 ≈ 51%: more than half
mu sync.RWMutexa key with two kinds: reading and writing
real line · redis/04-eventloop/main.go, line 32
6 of 8 The fix
One key for the sheet
Cooks share things. In the Redis build every goroutine reads and writes one shared map. In the kitchen, every cook adds a mark to one tally sheet.
Press Play. Two cooks plate a dish at the same moment and each adds a mark. The sheet says 41.
The lesson's fourth program does exactly that, with no protection. Four cooks each add 100,000 to one counter.
It printed expected 400000, got 195493. More than half the marks vanished, and the program said nothing was wrong.
What changed
- Marks on the sheet: 400,000 expected → 195,493 counted
Why is it a different number every run?
Which reads collide depends on the exact timing of the four cooks, and that changes on every run and every machine. Only the loss is certain.
The fix is a key hanging by the sheet. A cook takes the key, marks the sheet and hangs the key back. A second cook who wants to write waits for it.
Press Play. The same two cooks, the same 41, and now a key hangs by the sheet.
What changed
- Marks for two plates: 1 → 2
The key is a mutex. Take it with mu.Lock(), give it back with mu.Unlock().
A forgotten key loses marks silently. Go ships a tool that catches one: add -race to the run command and Go watches every read and write while the program runs.
Press Play. The lost-marks program again, run with -race added.
One last kind of key. Reading the sheet changes nothing, so many cooks could read at once safely. Only a writer needs the sheet to itself.
Press Play. The Redis build's map is read far more often than it is written, so it uses a key with two kinds.
A key with a reading kind and a writing kind is a read-write mutex. The Redis build uses one because reads outnumber writes.
7 of 8 Your guess
Your picture now
Goal met: 10 of 10 real lines read, with five words and three shapes. Which picture is closest to a Go server now?
Pick one.
c is how these builds serve: a goroutine per visitor, a channel to pass work along, and a mutex on what they share. a is the first Redis stage, one visitor at a time on purpose. b is the race: 4 cooks with no key counted 195,493 of 400,000.
8 of 8 Keep this
Keep this
A Go function hands back a slip with its answer, and you check it on the next line. defer leaves a note by the door. go starts a cook, a channel is the rail between cooks, and a mutex is the one key for what they share.
The trap: two goroutines writing one thing with no key lose updates and say nothing. Run with -race and it says so.
Coming up Every word you just read runs a real server. Next: build the first one, Redis, the in-memory notepad a programmer in Sicily wrote in 2009 because a database on disk could not keep up with live clicks.