ch := make(chan int, 10)
go func() {
for{
<-ch
}
}()
for i := 0; i < 100; i++ {
select {
case ch <- i: // thank goodness
log.Println(fmt.Sprintf("msgchan:%v", i))
break
default: // hm, push i to storage?
log.Println(fmt.Sprintf("default:%v", i))
break
}
time.Sleep(time.Microsecond)
}