Source file
test/chan/select8.go
1
2
3
4
5
6
7
8
9
10
11
12
13 package main
14
15 var ch = make(chan int)
16
17 func main() {
18 go func() {
19 for {
20 ch <- 5
21 }
22 }()
23
24 select {
25 case <-ch:
26 break
27 panic("unreachable")
28 }
29
30 select {
31 default:
32 break
33 panic("unreachable")
34 }
35
36 select {
37 case <-ch:
38 break
39 panic("unreachable")
40 default:
41 break
42 panic("unreachable")
43 }
44
45 select {
46 case <-ch:
47 break
48 panic("unreachable")
49 case ch <- 10:
50 panic("unreachable")
51 default:
52 break
53 panic("unreachable")
54 }
55 }
56
View as plain text