Browse Source

Merge pull request #12 from temoto/patch-1

Removed excess bool variable assignment in `if`s
pull/15/head
rodrigo moraes 13 years ago
parent
commit
51a7bc30e9
  1. 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)

Loading…
Cancel
Save