I am using goroutines/channels. Here is my code. Why is the timeout case not getting executed?
func main() {
c1 := make(chan int, 1)
go func() {
for {
time.Sleep(1500 * time.Millisecond)
c1 <- 10
}
}()
go func() {
for {
select {
case i := <-c1:
fmt.Println(i)
case <-time.After(2000 * time.Millisecond):
fmt.Println("TIMEOUT") // <-- Not Executed
}
}
}()
fmt.Scanln()
}