Fix mem_kv.go slice 0 length declaration (#11996)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2021-11-17 20:57:17 +08:00 committed by GitHub
parent b35e35ebda
commit b7de3bda3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,8 +155,8 @@ func (kv *MemoryKV) LoadWithPrefix(key string) ([]string, []string, error) {
kv.Lock()
defer kv.Unlock()
keys := make([]string, 0)
values := make([]string, 0)
var keys []string
var values []string
kv.tree.Ascend(func(i btree.Item) bool {
if strings.HasPrefix(i.(memoryKVItem).key, key) {
@ -179,7 +179,7 @@ func (kv *MemoryKV) MultiSaveAndRemoveWithPrefix(saves map[string]string, remova
kv.Lock()
defer kv.Unlock()
keys := make([]memoryKVItem, 0)
var keys []memoryKVItem
for _, key := range removals {
kv.tree.Ascend(func(i btree.Item) bool {
if strings.HasPrefix(i.(memoryKVItem).key, key) {
@ -202,7 +202,7 @@ func (kv *MemoryKV) RemoveWithPrefix(key string) error {
kv.Lock()
defer kv.Unlock()
keys := make([]btree.Item, 0)
var keys []btree.Item
kv.tree.Ascend(func(i btree.Item) bool {
if strings.HasPrefix(i.(memoryKVItem).key, key) {