Source file
test/switch3.go
1
2
3
4
5
6
7
8
9
10 package main
11
12 type I interface {
13 M()
14 }
15
16 func bad() {
17 var i I
18 var s string
19
20 switch i {
21 case s:
22 }
23
24 switch s {
25 case i:
26 }
27
28 var m, m1 map[int]int
29 switch m {
30 case nil:
31 case m1:
32 default:
33 }
34
35 var a, a1 []int
36 switch a {
37 case nil:
38 case a1:
39 default:
40 }
41
42 var f, f1 func()
43 switch f {
44 case nil:
45 case f1:
46 default:
47 }
48
49 var ar, ar1 [4]func()
50 switch ar {
51 case ar1:
52 default:
53 }
54
55 var st, st1 struct{ f func() }
56 switch st {
57 case st1:
58 }
59 }
60
61 func good() {
62 var i interface{}
63 var s string
64
65 switch i {
66 case s:
67 }
68
69 switch s {
70 case i:
71 }
72 }
73
View as plain text