Go has a mechanism to do a blocking read from one of several channels, the select statement. So you can say

select {
    case <- c1:
    case <- c2:
}

will block until we get input from either of these two channels. Very nice.

But this requires that I specify in the source code how many channels I want to poll. What if I have a slice or array of channels and I want to block until I get input on any of them?

Edit
Report