From 450ec4b5b433f767ead3f10817c9c3529190d48f Mon Sep 17 00:00:00 2001 From: 3DRX Date: Tue, 16 Jul 2024 22:10:02 +0800 Subject: [PATCH] Change variable name --- pkg/route/engine.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/route/engine.go b/pkg/route/engine.go index 4d6b8d64c..4881ee9cf 100644 --- a/pkg/route/engine.go +++ b/pkg/route/engine.go @@ -750,10 +750,10 @@ func (engine *Engine) ServeHTTP(c context.Context, ctx *app.RequestContext) { return } - // if ctx.Params is re-assigned by user in HandlerFunc and the capacity changed we need to realloc - paramsCnt := int(engine.maxParams) - if cap(ctx.Params) < paramsCnt { - ctx.Params = make(param.Params, 0, paramsCnt) + // if Params is re-assigned in HandlerFunc and the capacity is not enough we need to realloc + maxParams := int(engine.maxParams) + if cap(ctx.Params) < maxParams { + ctx.Params = make(param.Params, 0, maxParams) } // Find root of the tree for the given HTTP method