Pārlūkot izejas kodu

fixed wechat new client init with lock

ls 4 gadi atpakaļ
vecāks
revīzija
6a28211ad5
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      wechat/client.go

+ 1 - 1
wechat/client.go

@@ -20,7 +20,7 @@ func NewClient(appID, appSecret, token, encodingAESKey string) *Client {
 	if v, ok := cache.Load(key); ok {
 		return v.(*Client)
 	}
-	c := &Client{AppID: appID, AppSecret: appSecret, Token: token, EncodingAESKey: encodingAESKey, ReadLock: new(sync.Mutex)}
+	c := &Client{AppID: appID, AppSecret: appSecret, Token: token, EncodingAESKey: encodingAESKey, ReadLock: &sync.Mutex{}}
 	cache.Store(key, c)
 	return c
 }