Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter issues (docs) #370

Merged
merged 1 commit into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it'd be a good idea to remove the word "also":

// Middleware implements the middleware interface.

When reading documentation for this method, it might be confusing. "Middleware also implements it? In addition to what?"

func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {
return mw(handler)
}
Expand Down
9 changes: 6 additions & 3 deletions mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ import (
)

var (
// ErrMethodMismatch is returned when the error in the request does not match
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect "when the error in the request" should be "when the method in the request".

// 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.
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions route.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type Route struct {
buildVarsFunc BuildVarsFunc
}

// SkipClean bypasses cleaning the path, which includes removing duplicate
// slashes and URL encoding.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually not what this function does. It reports whether the SkipClean option is enabled for this route.

func (r *Route) SkipClean() bool {
return r.skipClean
}
Expand Down