The select Statement | Internals for Interns
In the previous article we walked through slices, maps, and channels, and how each of them is structured under the hood. Out of those three, channels are probably the most involved one in terms of how you actually use them — and there’s one language construct that really stands out when working with channels: the select statement. That’s what we’re going to be talking about in this post. And maybe I’m cheating a little here, because this article isn’t strictly about the runtime — select falls in between the runtime and the compiler — but that’s exactly what makes it an interesting corner of Go: it looks like a switch, behaves like a switch, and yet underneath it’s a coordinated dance between the compiler and the runtime.
Internals for Interns · Jesús Espino