This has confused me for the last month of learning Go:
func Auth(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { // hmmmm
// ...
next.ServeHTTP(w, r)
}
}
here we can see that the Auth func returns type http.HandlerFunc
.
That type is just a func. So when you call next.ServeHTTP
, when/where is that method defined?