Given something like this:
type Foo struct {
x int
}
type FooFoo struct {
foo *Foo
}
type Bar struct {
x int
}
Where Foo
is hidden (in my case due to vendoring), how can I create a FooFoo struct with a valid foo entry?
If Foo
were available, I could do
foofoo := &FooFoo{ foo: &Foo{5} }
or even
foofoo := &FooFoo{ foo: (*Foo)&Bar{ 5 } }
But I can't find a way to do it without mentioning Foo
.
I think I would need something like:
foofoo := &FooFoo{ foo: (*typeof(FooFoo.foo)) &Bar{ 5 } }