In this article, the author going to talk about how to build concurrent programs combining select, goroutines, and channels in Golang.
I’d recommend reading these two articles first to get familiar with the concepts of concurrency, channels, and goroutines.
- Concurrency in Golang, Goroutines, and Channels Explained
- File Processing Using Concurrency With GoLang
Golang Select Statement
From the Go tour documentation:
selectstatement lets a goroutine wait on multiple communication operations.
selectblocks until one of its cases can run, then it executes that case. It chooses one at random if multiple are ready.”