1 |
package example
|
|
2 |
|
|
3 |
func foo() int { |
1✔ |
4 |
n := 1
|
1✔ |
5 |
|
1✔ |
6 |
for i := 0; i < 3; i++ { |
4✔ |
7 |
if i == 0 { |
4✔ |
8 |
n++ |
1✔ |
9 |
} else if i*1 == 2-1 { |
4✔ |
10 |
n += 2
|
1✔ |
11 |
} else {
|
2✔ |
12 |
n += 3
|
1✔ |
13 |
} |
1✔ |
14 |
|
|
15 |
n++ |
3✔ |
16 |
} |
|
17 |
|
|
18 |
if n < 0 { |
1✔ |
19 |
n = 0
|
× |
20 |
} |
× |
21 |
|
|
22 |
n++ |
1✔ |
23 |
|
1✔ |
24 |
n += bar() |
1✔ |
25 |
|
1✔ |
26 |
bar() |
1✔ |
27 |
bar() |
1✔ |
28 |
|
1✔ |
29 |
switch {
|
1✔ |
30 |
case n < 20: |
1✔ |
31 |
n++ |
1✔ |
32 |
case n > 20: |
× |
33 |
n-- |
× |
34 |
default:
|
× |
35 |
n = 0
|
× |
36 |
} |
|
37 |
|
|
38 |
skip := true
|
1✔ |
39 |
if true { |
2✔ |
40 |
_ = skip |
1✔ |
41 |
} |
1✔ |
42 |
|
|
43 |
return n
|
1✔ |
44 |
} |
|
45 |
|
|
46 |
func bar() int { |
3✔ |
47 |
return 4 |
3✔ |
48 |
} |
3✔ |
49 |
|
|
50 |
func baz() int { |
× |
51 |
i := 1
|
× |
52 |
i = i + i |
× |
53 |
|
× |
54 |
return i
|
× |
55 |
} |
× |