Skip to content

Instantly share code, notes, and snippets.

@Bebbolus
Created November 30, 2018 16:51
Show Gist options
  • Save Bebbolus/062b03c2130077d49cc3b2f1f0877566 to your computer and use it in GitHub Desktop.
Save Bebbolus/062b03c2130077d49cc3b2f1f0877566 to your computer and use it in GitHub Desktop.
for _, v := range RoutesConf.Endpoints {
//load module:
plug, err := plugin.Open(v.Controller)
if err != nil {
kill(err)
}
//look up for an exported Controller type
symController, err := plug.Lookup("Controller")
if err != nil {
kill(err)
}
//check that loaded symbol is type Controller
var controller Controller
controller, ok := symController.(Controller)
if !ok {
kill("The Controller module have wrong type")
}
//define new middleware chain
var chain []Gate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment