Closing a channel is a signal to the goroutine reading from the
channel that there are no more values to send. There should never be
any confusion as to whether there are more values to send or not.
Either you are done, and you close the channel, or you are not done,
and you do not close the channel. Closing a channel twice implies
that you don't know whether you are done or not. By that argument,
closing a channel twice does not make sense, so the runtime panics.
It's true that there can be cases, especially when you aren't really
writing any values to the channel but are just using it as a
signalling mechanism, that you don't know whether you are done or not.
The current sense is that those cases are sufficiently rare that it's
appropriate to push the responsibility for the double close onto the
closer. Perhaps that should be rethought at some point, though not
for Go 1.7. The way to change this would be to make a proposal that
surveys some amount of Go code to see how much of it is (correctly)
checking for whether the channel has been closed before closing it.
If there is a lot of such code then perhaps the runtime should change
to silently ignore a close of a closed channel.
Ian