Note: I am getting this error while reading from the channel on the main goroutine. If I read using a separate go routine, then it works fine. I am curious to know why this is not wokring on main thread.
The channel is never closed, so the for range will wait for a fourth item.
I doubt it works when you use a separate go routine, it just appears to be working, as main waits for the wg, and gets a sync point there, though the receiving go routine is still waiting for data indefinitely.