-
Notifications
You must be signed in to change notification settings - Fork 929
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:url.Values is not safe map #172
Conversation
…ap read and map write error
Codecov Report
@@ Coverage Diff @@
## develop #172 +/- ##
==========================================
+ Coverage 66.57% 67.9% +1.32%
==========================================
Files 90 94 +4
Lines 5544 5851 +307
==========================================
+ Hits 3691 3973 +282
- Misses 1461 1466 +5
- Partials 392 412 +20
Continue to review full report at Codecov.
|
Does this fix #146? |
common/url.go
Outdated
} | ||
|
||
func (c URL) GetParam(s string, d string) string { | ||
var r string | ||
c.paramsLock.RLock() | ||
if r = c.Params.Get(s); r == "" { |
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.
'len(r) == 0' instead.
Port string | ||
Params url.Values | ||
//url.Values is not safe map, add to avoid concurrent map read and map write error | ||
paramsLock sync.RWMutex |
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.
pls place the paramsLock before Params
LGTM |
What this PR does:
Url.Values is not safe map, so add the lock to avoid concurrent map read and map write error
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: