Skip to content

Commit

Permalink
router: explicitly ignore cast err and remove ps shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
julienschmidt committed Aug 14, 2020
1 parent 4f0d806 commit 2d16253
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func New() *Router {
}

func (r *Router) getParams() *Params {
ps := r.paramsPool.Get().(*Params)
ps, _ := r.paramsPool.Get().(*Params)
*ps = (*ps)[0:0] // reset slice
return ps
}
Expand All @@ -235,7 +235,7 @@ func (r *Router) saveMatchedRoutePath(path string, handle Handle) Handle {
return func(w http.ResponseWriter, req *http.Request, ps Params) {
if ps == nil {
psp := r.getParams()
ps := (*psp)[0:1]
ps = (*psp)[0:1]
ps[0] = Param{Key: MatchedRoutePathParam, Value: path}
handle(w, req, ps)
r.putParams(psp)
Expand Down

0 comments on commit 2d16253

Please sign in to comment.