1
2
3
4
5
6
7
8
9 package p
10
11 func f(ch chan int) *int {
12 select {
13 case p1x := <-ch:
14 return &p1x
15 default:
16
17 }
18 select {
19 case p1 := <-ch:
20 return &p1
21 default:
22
23 }
24 select {
25 case p2 := <-ch:
26 return &p2
27 case p3 := <-ch:
28 return &p3
29 default:
30
31 }
32 select {
33 case p4, ok := <-ch:
34 if ok {
35 return &p4
36 }
37 default:
38
39 }
40 select {
41 case p5, ok := <-ch:
42 if ok {
43 return &p5
44 }
45 case p6, ok := <-ch:
46 if !ok {
47 return &p6
48 }
49 default:
50
51 }
52 return nil
53 }
54
View as plain text