Skip to main content

BLOG

Go from scratch, part 14: sync, context, cancellation and timeouts

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

Go from scratch, part 12: channels and select

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