Skip to content

Go Practice

Master goroutines, channels, interfaces, and simplicity-driven design.

ConceptDetails
Memory ModelGC, stack-allocated by default, escape analysis, pointers but no arithmetic
Type SystemStatic, structural typing, interfaces (implicit), generics (1.18+)
Error Handlingerror interface, multiple returns, errors.Is/As, no exceptions
ConcurrencyGoroutines, channels, select, sync package, context cancellation
Buildgo build, modules (go.mod), go test, go vet
StandardGo 1.22+
  • Accept interfaces, return structs
  • if err != nil — explicit error checking
  • Table-driven tests with testing package
  • context.Context threaded through call chains
  • Channel direction in function signatures (chan<-, <-chan)
  • Embedding for composition over inheritance
  • defer for cleanup, runs LIFO
Terminal window
practice/bin/ol list build go # which of these have references yet
practice/bin/ol start build go 01 # clone it stubbed into .scratchpad/
practice/bin/ol check build go 01 # run it; exit code is the verdict
practice/bin/ol diff build go 01 # your attempt against the reference

Exercises are ordered by concept, not by difficulty, so pick by the stars rather than by the number. An exercise listed below with no reference yet is a row in this table and nothing more; see the practice path for how the harness works.

#ExerciseConceptsDifficulty
01Concurrent web crawlerGoroutines, channels, sync.WaitGroup, rate limiting; course version: ag.06⭐⭐⭐
02In-memory key-value storesync.RWMutex, interfaces, HTTP handler; course version: gw.06⭐⭐
03Worker poolBounded concurrency, context cancellation; course version: dur.04⭐⭐⭐
04Generic sorted setGenerics, type constraints, cmp.Ordered; course version: dur.07⭐⭐⭐
05Log-structured storageio.Reader/Writer, binary encoding, file I/O; course version: dur.01⭐⭐⭐⭐
06Pub/sub message brokerChannels, fan-out, select, graceful shutdown; course version: dur.03⭐⭐⭐
07Rate limiter (token bucket)time.Ticker, atomic operations, middleware; course version: gw.03⭐⭐
08Raft consensus (simplified)State machines, RPC, leader election; course version: dur.10⭐⭐⭐⭐⭐
09Dependency injection containerReflection, interfaces, sync.Once⭐⭐⭐
10gRPC service + clientProtocol buffers, streaming, interceptors; course version: dur.04⭐⭐⭐⭐