Skip to content

Commit 537d12d

Browse files
authored
Merge branch 'master' into feat-add-rpc-name
2 parents 07bb2f4 + 1c9d339 commit 537d12d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3156
-1328
lines changed

core/conf/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func toLowerCaseInterface(v any, info *fieldInfo) any {
316316
case map[string]any:
317317
return toLowerCaseKeyMap(vv, info)
318318
case []any:
319-
var arr []any
319+
arr := make([]any, 0, len(vv))
320320
for _, vvv := range vv {
321321
arr = append(arr, toLowerCaseInterface(vvv, info))
322322
}

core/discov/internal/etcdclient_mock.go

Lines changed: 29 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/discov/internal/registry.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (c *cluster) getCurrent(key watchKey) []KV {
207207
return nil
208208
}
209209

210-
var kvs []KV
210+
kvs := make([]KV, 0, len(watcher.values))
211211
for k, v := range watcher.values {
212212
kvs = append(kvs, KV{
213213
Key: k,
@@ -308,7 +308,7 @@ func (c *cluster) load(cli EtcdClient, key watchKey) int64 {
308308
time.Sleep(coolDownUnstable.AroundDuration(coolDownInterval))
309309
}
310310

311-
var kvs []KV
311+
kvs := make([]KV, 0, len(resp.Kvs))
312312
for _, ev := range resp.Kvs {
313313
kvs = append(kvs, KV{
314314
Key: string(ev.Key),
@@ -352,7 +352,7 @@ func (c *cluster) reload(cli EtcdClient) {
352352
// cancel the previous watches
353353
close(c.done)
354354
c.watchGroup.Wait()
355-
var keys []watchKey
355+
keys := make([]watchKey, 0, len(c.watchers))
356356
for wk, wval := range c.watchers {
357357
keys = append(keys, wk)
358358
if wval.cancel != nil {

core/discov/internal/registry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/golang/mock/gomock"
1110
"github.com/stretchr/testify/assert"
1211
"github.com/zeromicro/go-zero/core/contextx"
1312
"github.com/zeromicro/go-zero/core/lang"
@@ -18,6 +17,7 @@ import (
1817
"go.etcd.io/etcd/api/v3/mvccpb"
1918
clientv3 "go.etcd.io/etcd/client/v3"
2019
"go.etcd.io/etcd/client/v3/mock/mockserver"
20+
"go.uber.org/mock/gomock"
2121
)
2222

2323
var mockLock sync.Mutex

core/discov/internal/statewatcher_mock.go

Lines changed: 15 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/discov/internal/statewatcher_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"sync"
55
"testing"
66

7-
"github.com/golang/mock/gomock"
7+
"go.uber.org/mock/gomock"
88
"google.golang.org/grpc/connectivity"
99
)
1010

0 commit comments

Comments
 (0)