1
2
3
4
5
6
7
8
9 package main
10
11 var fooCount = 0
12 var barCount = 0
13 var balCount = 0
14
15 func foo() (int, int) {
16 fooCount++
17 return 0, 0
18 }
19
20 func bar() (int, int) {
21 barCount++
22 return 0, 0
23 }
24
25 func bal() (int, int) {
26 balCount++
27 return 0, 0
28 }
29
30 var a, b = foo()
31 var c, _ = bar()
32 var _, _ = bal()
33
34 func main() {
35 if fooCount != 1 {
36 panic("fooCount != 1")
37 }
38 if barCount != 1 {
39 panic("barCount != 1")
40 }
41 if balCount != 1 {
42 panic("balCount != 1")
43 }
44 }
45
View as plain text