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:
“The
select
statement lets a goroutine wait on multiple communication operations.A
select
blocks until one of its cases can run, then it executes that case. It chooses one at random if multiple are ready.”
There is no ads to display, Please add some