I have a file like so:
package foo
type Handler struct {}
and then in another file, I have:
import (
"handlers/foo"
"handlers/bar"
"handlers/baz"
)
type AllHandlers struct {
Foo foo.Handler
Bar bar.Handler
Baz baz.Handler
}
then in another file I have:
all := routes.AllHandlers{}
foo := all.Foo{}
bar := all.Bar{}
baz := all.Baz{}
but it gives me this error:
Foo is not a type
I am probably doing some egregiously wrong. What I want to do is store all handlers in the AllHandlers struct, but not sure how to do that.
I believe the question can be simplified in this way:
func (h HuruInjection) GetInjections() struct{} {
return struct {
Foo foo.Handler
Bar bar.Handler
Baz baz.Handler
}
}
the above won't compile, essentially because you are returning a type instead of a value, as far as I can tell - for example, a Class instead of an instance of that Class. How can I get this to compile?
See this example: https://gist.github.com/ORESoftware/894438aee1d16aa9b2cb12ba25df274e