← Back to context

Comment by saghm

10 hours ago

> The solution I used when sending from multiple goroutines is to wait for the senders to be finished in the "main" goroutine and only the close the channels.

How do you know when they're finished though? It seems like you're need to have an additional channel or atomic boolean per goroutine for this, which just increases the amount of organizational burden.

Indeed. We use waitgroup. But... I guess it has to be used anyway, if you want to ensure that all started goroutines really did exit cleanly.