Skip to content

Commit 2d16253

Browse files
committed
router: explicitly ignore cast err and remove ps shadowing
1 parent 4f0d806 commit 2d16253

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

router.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func New() *Router {
220220
}
221221

222222
func (r *Router) getParams() *Params {
223-
ps := r.paramsPool.Get().(*Params)
223+
ps, _ := r.paramsPool.Get().(*Params)
224224
*ps = (*ps)[0:0] // reset slice
225225
return ps
226226
}
@@ -235,7 +235,7 @@ func (r *Router) saveMatchedRoutePath(path string, handle Handle) Handle {
235235
return func(w http.ResponseWriter, req *http.Request, ps Params) {
236236
if ps == nil {
237237
psp := r.getParams()
238-
ps := (*psp)[0:1]
238+
ps = (*psp)[0:1]
239239
ps[0] = Param{Key: MatchedRoutePathParam, Value: path}
240240
handle(w, req, ps)
241241
r.putParams(psp)

0 commit comments

Comments
 (0)