I have a struct like so:
type Docs struct {
Methods []string
Route string
}
and then I import that from another file like:
import tc "huru/type-creator"
and use it like so:
type DocsLocal struct {
tc.Docs
}
I am pretty certain that tc.Docs is just a field in DocsLocal, so this would be a case of composition, right?
if I want to create new instance of DocsLocal, I try this:
d:= DocsLocal{}
but how do I pass in the Methods and Route parameters? If I do this:
methods:= []string{"foo"}
r:="biscuit"
d:= DocsLocal{methods, r}
I get an error:
Cannot use methods (type []string) as type tc.Docs more
So what is the right syntax to use here?