Skip to content
Snippets Groups Projects
Commit ccd18812 authored by zengfanwei's avatar zengfanwei
Browse files

update url.AddParamAvoidNil method, add write lock

parent 2673df28
Branches
Tags
No related merge requests found
...@@ -404,11 +404,13 @@ func (c *URL) AddParam(key string, value string) { ...@@ -404,11 +404,13 @@ func (c *URL) AddParam(key string, value string) {
// AddParamAvoidNil will add key-value pair // AddParamAvoidNil will add key-value pair
func (c *URL) AddParamAvoidNil(key string, value string) { func (c *URL) AddParamAvoidNil(key string, value string) {
c.paramsLock.Lock()
defer c.paramsLock.Unlock()
if c.params == nil { if c.params == nil {
c.params = url.Values{} c.params = url.Values{}
} }
c.AddParam(key, value) c.params.Add(key, value)
} }
// SetParam will put the key-value pair into url // SetParam will put the key-value pair into url
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment