New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix context keys get set #702
Conversation
context.go
Outdated
@@ -160,14 +162,18 @@ func (c *Context) Set(key string, value interface{}) { | |||
if c.Keys == nil { | |||
c.Keys = make(map[string]interface{}) | |||
} | |||
c.KeysLocker.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest taking it before nil check to avoid a set being lost..
2 similar comments
add code to c.String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase correctly, than you can get some proper review.
The locking mechanism involved in this pull request is not needed as the original gin.Context should not be used outside the original gin gonic goroutine without copying it (Copy method). In fact, it even hides some biggest errors! |
@rohan-j-shah please re-commit the pull request to |
closing, ref #1391 |
Fix for : fatal error: concurrent map read and map write