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