Source file
test/abi/double_nested_struct.go
1
2
3
4
5
6
7
8
9
10
11
12
13 package main
14
15 import (
16 "fmt"
17 )
18
19 var sink *string
20
21 type stringPair struct {
22 a, b string
23 }
24
25 type stringPairPair struct {
26 x, y stringPair
27 }
28
29
30
31
32
33
34 func H(spp stringPairPair) string {
35 return spp.x.a + " " + spp.x.b + " " + spp.y.a + " " + spp.y.b
36 }
37
38
39
40 func G(a, b, c, d string) stringPairPair {
41 return stringPairPair{stringPair{a, b}, stringPair{c, d}}
42 }
43
44 func main() {
45 spp := G("this", "is", "a", "test")
46 s := H(spp)
47 gotVsWant(s, "this is a test")
48 }
49
50 func gotVsWant(got, want string) {
51 if got != want {
52 fmt.Printf("FAIL, got %s, wanted %s\n", got, want)
53 }
54 }
55
View as plain text