conc - better structured concurrency for go
last updated: Oct 20, 2023
https://github.com/sourcegraph/conc
concis your toolbelt for structured concurrency in go, making common tasks easier and safer.
The main goals of the package are:
- Make it harder to leak goroutines
- Handle panics gracefully
- Make concurrent code easier to read
In
conc, the owner of a goroutine is always aconc.WaitGroup. Goroutines are spawned in aWaitGroupwith(*WaitGroup).Go(), and(*WaitGroup).Wait()should always be called before theWaitGroupgoes out of scope.
references Go statement considered harmful in the README 😍
cf flowmatic, which looks nicer but I've never used either