Skip to content

Commit

Permalink
Merge pull request #944 from georgehao/develop
Browse files Browse the repository at this point in the history
fix:  URL.String() data race panic
  • Loading branch information
zouyx committed Dec 20, 2020
2 parents 56b7abe + 6be20c8 commit d0402f2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ func isMatchCategory(category1 string, category2 string) bool {
}

func (c *URL) String() string {
c.paramsLock.Lock()
defer c.paramsLock.Unlock()
var buf strings.Builder
if len(c.Username) == 0 && len(c.Password) == 0 {
buf.WriteString(fmt.Sprintf("%s://%s:%s%s?", c.Protocol, c.Ip, c.Port, c.Path))
Expand Down

0 comments on commit d0402f2

Please sign in to comment.