One channel with one receiver and unknown number of goroutines senders causing deadlock
问题 I have one channel and the receiver is main. I spawn multiple goroutines that each send a string over the channel. Now, this causes a deadlock because I didn't close the channel properly using the close function. The thing is, I have no idea how many goroutines will be created, so there's no way to know when to close the channel. I've tried using WaitGroup, the problem is, I've read that I can't use Add in the goroutine and that I should use wg.Add(1) in the main process/goroutine, I've tried