Explorar o código

fixed wechat new client init with lock

ls %!s(int64=4) %!d(string=hai) anos
pai
achega
6a28211ad5
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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
 }