Why second time geeting output from channel it appeared that channel closed: false?
Obviously, channel closed: false is equals to cnannel is open. But how it can be open if it has been allready closed?!
The second result from a receive operation is not whether or not the channel is closed but whether the receive was successful: https://golang.org/ref/spec#Receive_operator, making it similar to when you lookup a result from a map: v, ok := a[x]
The close spec explains the second boolean result very well on receive operator.
After calling close , and after any previously sent values have been received, receive operations will return the zero value for the channel’s type without blocking. The multi-valued receive operation returns a received value along with an indication of whether the channel is closed.
That means you can use the second untyped boolean variable to check whether the channel closed or not.
@cinematik
If you get False from the receiver operation, it means the channel is closed not open. I recommend you to use okname to make it more clear and go way.