Wednesday, May 02, 2012

Golang nested struct

Pretty much impossible to find but lets say you have

type Foo struc {
 B String
}
type Bar struc {
 Foo
 A string
}
New instance of Bar can be initialized like
b:=Bar{Foo:Foo{B:"A"},A:"B"}

No comments: