mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 20:22:20 +08:00
refactor: using maps.Clone
https://go-review.googlesource.com/c/go/+/471400
This commit is contained in:
parent
077a2f39c8
commit
8511461b26
@ -10,6 +10,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
|
"maps"
|
||||||
"math"
|
"math"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net"
|
"net"
|
||||||
@ -130,11 +131,8 @@ func (c *Context) Copy() *Context {
|
|||||||
cp.fullPath = c.fullPath
|
cp.fullPath = c.fullPath
|
||||||
|
|
||||||
cKeys := c.Keys
|
cKeys := c.Keys
|
||||||
cp.Keys = make(map[any]any, len(cKeys))
|
|
||||||
c.mu.RLock()
|
c.mu.RLock()
|
||||||
for k, v := range cKeys {
|
cp.Keys = maps.Clone(cKeys)
|
||||||
cp.Keys[k] = v
|
|
||||||
}
|
|
||||||
c.mu.RUnlock()
|
c.mu.RUnlock()
|
||||||
|
|
||||||
cParams := c.Params
|
cParams := c.Params
|
||||||
|
Loading…
x
Reference in New Issue
Block a user