Also since nobody else mentioned it, for completeness: the optional second argument to the receive will always tell you if the channel is already closed, if all you are doing is trying to distinguish the zero value from a closed versus unclosed channel.
https://golang.org/ref/spec#Receive_operator -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.