One thing I do not like about Go is that channel receive also removes the data from the channel. This only allows two goroutines to communicate with each other even though there are several cases when two or more goroutines should be able to talk to each other.
I know I could make an array of channels and have channel per goroutine, but moving data from one goroutine to all of the other goroutines is much more data on ram than moving one copy of the data to all goroutines.
Think about a case when I have thousand clients connected to server and I want one to send message to only half of them that is five hundred goroutines receiving that message. If the message is 512 bytes this becomes 250 kilobytes of data in the ram moving, even though it's possible to move the same data only once if channels would not remove the data on receive.
So I am asking if there is some simple way to do this or do I have to use mutex from the sync package? Though please tell me if I am calculating wrong and channels do not copy the data, because in that case I can just manage array of channels.