Go: Ordering in Select Statements

Vincent
A Journey With Go
Published in
4 min readApr 8, 2020
Illustration created for “A Journey With Go”, made from the original Go Gopher, created by Renee French.

ℹ️ This article is based on Go 1.14.

The select statement lets a goroutine on multiple channel operations. However, when all of them are ready to communicate, Go has to choose among them. Go has also needs to handle cases when none of them are ready. Let’s start with the order with ready channels.

Order

--

--