mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-12 02:58:08 +08:00
refactor(context): using maps.Clone (#4333)
ref: https://go-review.googlesource.com/c/go/+/471400
This commit is contained in:
parent
59e9d4a794
commit
414de60574
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user