This question is an exact duplicate of:
I have this in a file:
import (
"huru/routes/login"
"huru/routes/nearby"
"huru/routes/person"
"huru/routes/register"
"huru/routes/share"
)
// Handlers
type RegisterHandler = register.Handler
type LoginHandler = login.Handler
type NearbyHandler = nearby.Handler
type ShareHandler = share.Handler
type PersonHandler = person.Handler
this works, but I am wondering if there is a way to group them, like so:
// PSEUDO CODE
var Handlers = {
Register : register.Handler
Login : login.Handler
Nearby : nearby.Handler
Share : share.Handler
Person : person.Handler
}
note yes that's bogus syntax but hopefully you know what I mean. What I am trying to do is export a namespace, so I can do this:
import (
"huru/x"
)
x.Handlers.Register{}
instead of:
x.RegisterHandler{}
</div>