I was trying to write a function but the issue here surprised me.
userGroup.Use(
middleware.BasicAuth(func(username, password string, c echo.Context) (bool, error) {
if username == "joe" && password == "123"{
return true, nil
}
return false, nil
}) // <- error happens here
)
userGroup.Use(
middleware.BasicAuth(func(username, password string, c echo.Context) (bool, error) {
if username == "joe" && password == "123"{
return true, nil
}
return false, nil
})) // <- !!
Spent an hour for a bug but turns out the last closing parentheses must not float around. Is this an issue with semicolons, commas or indentation? I remember JS not caring about this kind of stuff The error I was getting was :
missing ',' before newline in argument list |syntax