I have a go routine that periodically polls every interval and does a action. It also checks for done channel, as a end signal, to stop the polling.
go func(){
for {
select{
case <-myticker.C:
do_something()
case <-done:
fmt.Println("I am done")
return
}
}
}
I realized that if I close the channel, It also runs as if the value is passed to done channel, It prints out "I am done" Why is that so?