go-best-practices
go-best-practices copied to clipboard
Concurrency Section Improvements
What I think we need to add in order to feel that concurrency is complete for now.
- [x] supervising goroutines (e.g. tracking them with wait groups or communicating with them via channels)
- [x] examples of leaky concurrency + architectural solutions to avoid it.
- [ ] bounded concurrency (using a "pool" of goroutines, rather than fire off any number of them)
- [ ] testing concurrency + the race detector
Please contribute to this Issue thread so that we can track here the topics we want to talk about.
Indeed. A hard and fast rule is:
If you use the go
keyword, you need to be asking yourself "How will this goroutine terminate? Will it ever? How do I ensure that it has a potential exit case."