mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 21:06:39 +08:00
Applying write lock even before nil check
This commit is contained in:
parent
4db1d0ce36
commit
8c413be455
@ -159,10 +159,10 @@ func (c *Context) Error(err error) *Error {
|
||||
// Set is used to store a new key/value pair exclusivelly for this context.
|
||||
// It also lazy initializes c.Keys if it was not used previously.
|
||||
func (c *Context) Set(key string, value interface{}) {
|
||||
c.KeysLocker.Lock()
|
||||
if c.Keys == nil {
|
||||
c.Keys = make(map[string]interface{})
|
||||
}
|
||||
c.KeysLocker.Lock()
|
||||
c.Keys[key] = value
|
||||
c.KeysLocker.Unlock()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user