Skip to content

Commit

Permalink
Remove golint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kveselkov committed Oct 24, 2019
1 parent ff4e71f commit e5c266d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions mux.go
Expand Up @@ -361,9 +361,9 @@ func (r *Router) Walk(walkFn WalkFunc) error {
return r.walk(walkFn, []*Route{})
}

// SkipRouter is used as a return value from WalkFuncs to indicate that the
// ErrSkipRouter is used as a return value from WalkFuncs to indicate that the
// router that walk is about to descend down to should be skipped.
var SkipRouter = errors.New("skip this router")
var ErrSkipRouter = errors.New("skip this router")

// WalkFunc is the type of the function called for each route visited by Walk.
// At every invocation, it is given the current route, and the current router,
Expand All @@ -373,7 +373,7 @@ type WalkFunc func(route *Route, router *Router, ancestors []*Route) error
func (r *Router) walk(walkFn WalkFunc, ancestors []*Route) error {
for _, t := range r.routes {
err := walkFn(t, r, ancestors)
if err == SkipRouter {
if err == ErrSkipRouter {
continue
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion mux_test.go
Expand Up @@ -1598,7 +1598,7 @@ func TestWalkSingleDepth(t *testing.T) {
err := r0.Walk(func(route *Route, router *Router, ancestors []*Route) error {
matcher := route.matchers[0].(*routeRegexp)
if matcher.template == "/d" {
return SkipRouter
return ErrSkipRouter
}
if len(ancestors) != depths[i] {
t.Errorf(`Expected depth of %d at i = %d; got "%d"`, depths[i], i, len(ancestors))
Expand Down
18 changes: 9 additions & 9 deletions regexp.go
Expand Up @@ -181,16 +181,16 @@ func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
}
}
return r.regexp.MatchString(host)
} else {
if r.regexpType == regexpTypeQuery {
return r.matchQueryString(req)
}
path := req.URL.Path
if r.options.useEncodedPath {
path = req.URL.EscapedPath()
}
return r.regexp.MatchString(path)
}

if r.regexpType == regexpTypeQuery {
return r.matchQueryString(req)
}
path := req.URL.Path
if r.options.useEncodedPath {
path = req.URL.EscapedPath()
}
return r.regexp.MatchString(path)
}

// url builds a URL part using the given values.
Expand Down

0 comments on commit e5c266d

Please sign in to comment.