1package main 2 3func main() { 4 ch1 := make(chan int); 5 ch2 := make(chan int); 6 go func (ch1, ch2 chan int) { ch1 <- 1; ch2 <- 2; } (ch1, ch2); 7 count := 0; 8 var v int; 9 for count != 2 { 10 select 11 { 12 case v := <- ch1: 13 if v != 1 { 14 panic(0) 15 } 16 count++ 17 18 case v = <- ch2: 19 if v != 2 { 20 panic(1) 21 } 22 count++ 23 } 24 } 25 if v != 2 { 26 panic(2) 27 } 28} 29