I want to spawn a goroutine to listen to two channels of type chan int
and chan os.Signal
. I want the behavior to be specific depending on what's received on either channels. Meaning some os.Signal
may cause os.exit()
and some may not, some int
received through chan int
may print a statement and some may call a function, so I need this gorountine to be always running since the behaviors are different. And I'd like this to be all handed by one function.
I'm having a hard time figuring out how to achieve this syntactically. It doesn't seem like I can have range
loops inside of a select
block nor does it seem like I can have a select
block inside a range
loop. I can't find any resource online on this. Can someone give me an example?