From 4baed64916c9d3c9a3b067384e5cb186b5c0ccfd Mon Sep 17 00:00:00 2001 From: Matt Silverlock Date: Mon, 30 Apr 2018 20:04:43 -0700 Subject: [PATCH] Fix linter issues (docs) --- middleware.go | 2 +- mux.go | 9 ++++++--- route.go | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/middleware.go b/middleware.go index ec79e5d7..cf6cfc33 100644 --- a/middleware.go +++ b/middleware.go @@ -12,7 +12,7 @@ type middleware interface { Middleware(handler http.Handler) http.Handler } -// MiddlewareFunc also implements the middleware interface. +// Middleware also implements the middleware interface. func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler { return mw(handler) } diff --git a/mux.go b/mux.go index efabd241..5b39694e 100644 --- a/mux.go +++ b/mux.go @@ -13,8 +13,11 @@ import ( ) var ( + // ErrMethodMismatch is returned when the error in the request does not match + // the method defined against the route. ErrMethodMismatch = errors.New("method is not allowed") - ErrNotFound = errors.New("no matching route was found") + // ErrNotFound is returned when no route match is found. + ErrNotFound = errors.New("no matching route was found") ) // NewRouter returns a new router instance. @@ -95,9 +98,9 @@ func (r *Router) Match(req *http.Request, match *RouteMatch) bool { if r.MethodNotAllowedHandler != nil { match.Handler = r.MethodNotAllowedHandler return true - } else { - return false } + + return false } // Closest match for a router (includes sub-routers) diff --git a/route.go b/route.go index 9f261438..cc37ad6c 100644 --- a/route.go +++ b/route.go @@ -43,6 +43,8 @@ type Route struct { buildVarsFunc BuildVarsFunc } +// SkipClean bypasses cleaning the path, which includes removing duplicate +// slashes and URL encoding. func (r *Route) SkipClean() bool { return r.skipClean }