Removed excess bool variable assignment in ifs
This commit is contained in:
4
mux.go
4
mux.go
@@ -51,7 +51,7 @@ type Router struct {
|
|||||||
// Match matches registered routes against the request.
|
// Match matches registered routes against the request.
|
||||||
func (r *Router) Match(req *http.Request, match *RouteMatch) bool {
|
func (r *Router) Match(req *http.Request, match *RouteMatch) bool {
|
||||||
for _, route := range r.routes {
|
for _, route := range r.routes {
|
||||||
if matched := route.Match(req, match); matched {
|
if route.Match(req, match) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
}
|
}
|
||||||
var match RouteMatch
|
var match RouteMatch
|
||||||
var handler http.Handler
|
var handler http.Handler
|
||||||
if matched := r.Match(req, &match); matched {
|
if r.Match(req, &match) {
|
||||||
handler = match.Handler
|
handler = match.Handler
|
||||||
setVars(req, match.Vars)
|
setVars(req, match.Vars)
|
||||||
setCurrentRoute(req, match.Route)
|
setCurrentRoute(req, match.Route)
|
||||||
|
|||||||
Reference in New Issue
Block a user