Phase 1 of 4 · Study weeks 1-4
The language, goroutines and bounded concurrency
This phase makes the first checkpoint possible: a delivery core that never runs away, stops when told and shows when it leaks.
Topics every week
- Week 18 h
- Types, interfaces and generics
- Errors, wrapping and
errors.Is - Slices, maps and aliasing
- The memory model
Hand inA catalogue of 10 traps (nil interfaces, slice aliasing, loop variables), tested
- Week 28 h
- Goroutines and channels
contextand cancellationerrgroup- Channels against mutexes
- Goroutine lifetimes
Hand inA worker pool with cancellation and a test that proves no worker outlives it
- Week 38 h
- The scheduler and what blocks it
- The garbage collector and GC settings
- Escape analysis
pproffor CPU, heap and goroutines
Hand inA profile report: one hot function and one allocation source, with a fix
- Week 48 h
- The race detector
- Fuzzing and table tests
testing/synctestfor time- The goroutine leak profile
Hand inCheckpoint 1: the delivery core, its tests and the reference table
Practice projects
- Practice 1, the trap catalogue (Week 1): write 10 cases that surprise people (a nil pointer in a non-nil interface, a slice that shares memory after
append, a map iteration order). Done when: each has a test that asserts the surprising result and a one-line rule. - Practice 2, the leak (Week 2): start a goroutine that blocks on a channel nobody reads. Done when: a test fails because of the leak, and the fix uses a context so the goroutine exits when the caller stops.
- Practice 3, the pool (Week 4): build a pool with a global limit, a per-key limit and cancellation. Done when: 100,000 queued tasks never run more than the limits, memory stays flat and a cancelled task never starts.
- Optional, a pipeline: chain three stages with channels. Done when: closing the first stage lets the others drain and exit, and the race detector stays quiet.
GitHub repos to study
Existence and last commit were checked on 22 Nov 2026 by shallow clone. Every repository below had a commit in the last 12 months. Look at the README for archive notices before you rely on one.
| Repo | What to read | Week |
|---|---|---|
| golang/go | runtime scheduler and sync package sources | 3 |
| uber-go/guide | A style guide: goroutine lifetimes, errors and channel size | 2 |
| google/pprof | The profile format and the visualisations | 3 |
| golang/tools | The analysis passes behind go vet | 4 |
Milestone checkpoint
Build Checkpoint 1. Write the test harness first: a fake server with hung, slow and fast endpoints, and a counter of the highest number of deliveries in flight to each. Then add the pool, the limits and the cancellation. Add the seeded leak and watch the leak profile catch it. Hand in the reference table with your own numbers, ADR-1 (errors and cancellation) and ADR-2 (pool and limits).
Check yourself
Answer each question in your head first, then open it to check.
Why can an interface holding a nil pointer be non-nil?
An interface value holds a type and a value. A nil pointer of a concrete type has a type, so the interface is not nil.What does
contextcancellation stop, and what does it leave running?It signals code that listens for it, such ashttprequests andselectonctx.Done(). Code that never checks the context keeps running.When do you use a channel and when a mutex?
A channel to pass ownership or signal events; a mutex to protect shared state. A mutex is simpler when many goroutines touch one value.What does the race detector find, and what does it miss?
It finds data races that happen in the run. It misses races that never occur in your tests, and it does not find deadlocks or leaks.Why does
go func()per event fail under load?Nothing bounds the goroutines, so slow endpoints pile up goroutines and memory until the process dies.