去:双向通道中端点必须关闭哪个通道?

Due to Go's philosophy a channel should be closed by the sender only. When a channel is bidirectional where should it be closed?

The question is a little bit hard to interpret since go does not have bidirectional channels. Data flows only in a single direction - from a writer to a reader.

What you can have in Go is multiple readers or writers on a channel. Whether this makes sense depends a little bit on the context. If you have multiple writers you would need some kind of synchronization for the close operation, e.g. a mutex. However you would then also need to lock this before each write operation in order to ensure that you don't write on a closed channel. If you don't really need the information that the channel was closed on receiver side you could also simply omit the close, as the garbage collector will also collect unclosed channels just fine.