0005: Concurrency Is Go's Superpower
Date: 2026-06-14 Status: Accepted
Context
Learner now has interfaces, error handling, struct tags/JSON, and testing. The next frontier is concurrency — the feature that makes Go the language of choice for cloud-native infrastructure. Kubernetes, Docker, Prometheus, and etcd all depend heavily on goroutines and channels.
Insight
Go's concurrency model is fundamentally different from thread-based models in other languages. The key insight is "share memory by communicating" (channels) rather than "communicate by sharing memory" (mutexes). This is counter-intuitive for developers coming from other languages where locks and shared state are the default.
The progression should be: goroutines first (what they are, how cheap they are), then channels (the communication primitive), then select (multiplexing), then patterns (pipelines, fan-in/out, done channels). The second lesson (0006) will cover sync primitives for when channels aren't the right tool.
Cloud-native projects use goroutines pervasively: Kubernetes runs a goroutine per controller, Docker uses them for container lifecycle management, Prometheus for metric scraping. Understanding goroutines is essential for reading and contributing to any of these projects.
Consequences
- Lesson 0005: Goroutines, channels (unbuffered, buffered, directional), select, close semantics
- Lesson 0006 will follow with sync primitives (Mutex, WaitGroup, Once, atomic) and race detector
- Should emphasize "share memory by communicating" as the Go philosophy
- Must include the channel close semantics (only sender closes, receive from closed = zero value)
- Exercises should build a practical pipeline pattern as used in infrastructure tools