From 8511461b268cdab40dca8a282172df0dff2a8cbe Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Thu, 14 Aug 2025 13:49:45 +0800 Subject: [PATCH] refactor: using maps.Clone https://go-review.googlesource.com/c/go/+/471400 --- context.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/context.go b/context.go index 842ad2ff..4a9a302a 100644 --- a/context.go +++ b/context.go @@ -10,6 +10,7 @@ import ( "io" "io/fs" "log" + "maps" "math" "mime/multipart" "net" @@ -130,11 +131,8 @@ func (c *Context) Copy() *Context { cp.fullPath = c.fullPath cKeys := c.Keys - cp.Keys = make(map[any]any, len(cKeys)) c.mu.RLock() - for k, v := range cKeys { - cp.Keys[k] = v - } + cp.Keys = maps.Clone(cKeys) c.mu.RUnlock() cParams := c.Params