How can I do this:
type A struct { MemberA string } type B struct { A A MemberB string }
...
b := B { MemberA: "test1", MemberB: "test2", } fmt.Printf("%+v ", b)
Compiling that gives me: "unknown B field 'MemberA' in struct literal"
How can I initialize MemberA (from the "parent" struct) when I provide literal struct member values like this?
2.1m questions
2.1m answers
60 comments
57.0k users