This is about an error I am getting while I try to build my application.
I use Gorilla mux as a router and Alice for chaining the middlewares.
And I defined a custom type named 'Middleware' with the following signature;
type Middleware func(http.Handler) http.Handler
And following is the code where I chain the middlewares and the handler, using Alice.
if len(config.Middlewares()) > 0 {
subRouter.Handle(config.Path(), alice.New(config.Middlewares()...).Then(config.Handler())).Methods(config.Methods()...).Schemes(config.Schemes()...)
}
But when I try to build, I get the following error in the console;
infrastructure/router.go:88:63: cannot use config.Middlewares() (type []Middleware) as type []alice.Constructor in argument to alice.New
I'd checked the code for alice.Constructor. It also has the same signature as my Middleware type.
I am using Go 1.13, and the following version of Alice.
github.com/justinas/alice v1.2.0
Can you please help me to sort out this?