When reading from multiple channels in a select statement, if multiple are
ready then one is pseudo-randomly chosen. I've never seen it used like
this, where a literal is put into a channel, but it seems to works the same
way in my testing. Of course, it must be a buffered channel. I got this
working from your sample: https://play.golang.org/p/GI67itVKAE

I don't believe it's correct that there are separate goroutines in the
select statement, but someone more familiar with language internals would
have to explain why or why not.

In any case, at least we both understand the behavior now. Thanks for
bringing this use-case to my attention.

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
groupgolang-nuts @
postedMay 17, '16 at 1:59p
activeMay 19, '16 at 5:27p



site design / logo © 2021 Grokbase