How do I initialize a struct with a double pointer field? I am trying to initialize a struct as below:
type atype struct {
val string
}
a := &struct {
StringValue string
Pointer **atype
}{
StringValue: "FOO",
//this is the relevant bit
Pointer : &(&atype{
val: "test"
})
}
This gives me an error : invalid pointer type **basicAppConfig for composite literal
What is wrong in my logic? I take the pointer to a pointer to the value.
I also tried to use
reflect.PtrTo(&atype{
val: "string"
})
without success...
newto your heart's content. play.golang.org/p/995hzR3EVWQ