refactor: using maps.Clone

https://go-review.googlesource.com/c/go/+/471400
This commit is contained in:
cuiweixie 2025-08-14 13:49:45 +08:00
parent 077a2f39c8
commit 8511461b26

View File

@ -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