3 ms·
Why not close the channel instead of sending 0? You can detect a closed channel with the "x, ok := <-y" form.
by JulianMorrison 14y ago
Why not close the channel instead of sending 0? You can detect a closed channel with the "x, ok := <-y" form.
- thomas11 14y agoAuthor here. Originally I thought it's bad form to close a channel that the client passes in. But you're the second one to point this out and I've come around to seeing it's clearer and more idiomatic. Just pushed the change.