Everything so far was the warm-up. Go concurrency is why the language exists and probably why you’re reading this series. And it starts with two letters: go. A goroutine is a function flying solo Put go in front of any call and that function runs concurrently, without blocking its launcher (A Tour of Go, goroutines): […]
READ MORE
Last article our goroutines flew solo and we waited for them with time.Sleep, which is like synchronizing watches by yelling out the window. Today the real tool arrives: Go channels, the typed pipes goroutines pass data through and, as a bonus, synchronize with. Channels: send, receive, block A channel is created with make and it’s […]
READ MORE
You’ve got goroutines and channels. Today we combine them into the three Go concurrency patterns that solve 90% of real concurrent problems. These are the same blueprints industry uses, documented on the official Go blog and in Rob Pike’s classic talk Go Concurrency Patterns. Pipeline: the assembly line A pipeline is a series of stages […]
READ MORE
Channels are the preferred road, not the only one. Today we complete the toolbox with the sync package for classic synchronization and context, the standard mechanism for telling an army of goroutines the show is over. Getting Go context right is half of production readiness. sync.WaitGroup: waiting without sleeping The official replacement for those time.Sleep […]
READ MORE