引用“不是类型”-将类型存储在结构中

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

I solved this problem, the trick is to use the right syntax. Instead of doing this:

import (
   "handlers/foo"
   "handlers/bar"
   "handlers/baz"
)

type AllHandlers struct {
    Foo foo.Handler
    Bar bar.Handler
    Baz baz.Handler
}

I did this:

import (
   "handlers/foo"
   "handlers/bar"
   "handlers/baz"
)


type Foo = foo.Handler
type Bar = bar.Handler
type Baz = baz.Handler

then I could import this, and use Foo, Bar, Baz as types. So I don't think you can group types in a struct, but you can import/export types by using the above syntax.