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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…