Channels, When the program flow exit from the infinite for { select }

In the code you provided, there is no escape from the infinite loop other than a panic. So the loop will run until it panics on a closed channel or the program stops. You probably want to put some kind of done-signaling logic in the code.