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
1 parent 8031b43 commit daede0f
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 daede0f

Please sign in to comment.