From 97f1857f10e311d6eecfde70c8f5ff5f2a7281a7 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Fri, 4 Oct 2024 20:09:06 +0800 Subject: [PATCH] fix: fix slice init length --- pkg/smokescreen/metrics/mocks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/smokescreen/metrics/mocks.go b/pkg/smokescreen/metrics/mocks.go index 10cc78ca..fc10a02d 100644 --- a/pkg/smokescreen/metrics/mocks.go +++ b/pkg/smokescreen/metrics/mocks.go @@ -66,7 +66,7 @@ func (m *MockMetricsClient) GetCount(metric string, tags map[string]string) (uin } i, ok := m.counts[mName] if !ok { - keys := make([]string, len(m.counts)) + keys := make([]string, 0, len(m.counts)) for k, _ := range m.counts { keys = append(keys, k) } @@ -92,7 +92,7 @@ func (m *MockMetricsClient) GetValues(metric string, tags map[string]string) ([] } i, ok := m.values[mName] if !ok { - keys := make([]string, len(m.counts)) + keys := make([]string, 0, len(m.counts)) for k, _ := range m.values { keys = append(keys, k) }