Channel closeout in the multiple-senders case is rather messy.
You have to avoid closing twice, and avoid getting the receiver
hung waiting on a channel with no senders left. This takes
some extra coordination.
You can use the wait group mechanism to track the exiting of
all the senders. Before the "go", do an "w.Add". In the goroutine,
do a "defer w.Done()", so the count goes down when the goroutine
exits, no matter how it does it. Then have an extra goroutine which
does the "w.Wait()" on the wait group. It just closes the channel and
exits. The receiver on the main channel then sees the channel EOF,
and the receiver knows everybody is done.
Bear in mind that maps are not thread-safe. If you store into
a map from one goroutine and read it from another, you must put
mutex locks around the map accesses.
John Nagle