superstruct_example.go (341B)
1 package superstruct 2 3 import ( 4 "fmt" 5 ) 6 7 type first struct { 8 A string 9 C string 10 } 11 12 type second struct { 13 B string 14 C string 15 } 16 17 18 func ExampleCreateAndCopy() { 19 a := first{"a", "c"} 20 b := second{"b", "d"} 21 c, err := CreateAndCopy(a, b) 22 if err != nil { 23 return 24 } 25 26 fmt.Println(SortedStructString(c)) 27 // Output: 28 // A: a 29 // B: b 30 // C: d 31 }