From de2178ccc86c0801a39ff41fcfd3d7256f52faaf Mon Sep 17 00:00:00 2001 From: alingse Date: Sun, 26 May 2024 22:55:29 +0800 Subject: [PATCH] fix: fix miss makezero bug Signed-off-by: alingse --- scripts/docker-integration-tests/query_fanout/restrict.go | 2 +- src/cmd/services/m3comparator/main/parser/parser.go | 2 +- src/dbnode/integration/integration_data_verify.go | 2 +- src/query/api/v1/handler/prometheus/response.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/docker-integration-tests/query_fanout/restrict.go b/scripts/docker-integration-tests/query_fanout/restrict.go index 8f2bb7f8ee..906a89f38c 100644 --- a/scripts/docker-integration-tests/query_fanout/restrict.go +++ b/scripts/docker-integration-tests/query_fanout/restrict.go @@ -325,7 +325,7 @@ type values []value type value []interface{} func (r *result) genID() result { - tags := make(sort.StringSlice, len(r.Metric)) + tags := make(sort.StringSlice, 0, len(r.Metric)) for k, v := range r.Metric { tags = append(tags, fmt.Sprintf("%s:%s,", k, v)) } diff --git a/src/cmd/services/m3comparator/main/parser/parser.go b/src/cmd/services/m3comparator/main/parser/parser.go index 1c5902b30d..a40110e00d 100644 --- a/src/cmd/services/m3comparator/main/parser/parser.go +++ b/src/cmd/services/m3comparator/main/parser/parser.go @@ -112,7 +112,7 @@ func (v *Value) UnmarshalJSON(data []byte) error { // IDOrGenID gets the ID for this result. func (r *Series) IDOrGenID() string { if len(r.id) == 0 { - tags := make(sort.StringSlice, len(r.Tags)) + tags := make(sort.StringSlice, 0, len(r.Tags)) for _, v := range r.Tags { tags = append(tags, fmt.Sprintf("%s:%s,", v[0], v[1])) } diff --git a/src/dbnode/integration/integration_data_verify.go b/src/dbnode/integration/integration_data_verify.go index 819a9d0a0d..58e800db8b 100644 --- a/src/dbnode/integration/integration_data_verify.go +++ b/src/dbnode/integration/integration_data_verify.go @@ -236,7 +236,7 @@ func writeVerifyDebugOutput( list := make(readableSeriesList, 0, len(series)) for i := range series { - tags := make([]readableSeriesTag, len(series[i].Tags.Values())) + tags := make([]readableSeriesTag, 0, len(series[i].Tags.Values())) for _, tag := range series[i].Tags.Values() { tags = append(tags, readableSeriesTag{ Name: tag.Name.String(), diff --git a/src/query/api/v1/handler/prometheus/response.go b/src/query/api/v1/handler/prometheus/response.go index a28384e162..badffdd50e 100644 --- a/src/query/api/v1/handler/prometheus/response.go +++ b/src/query/api/v1/handler/prometheus/response.go @@ -41,7 +41,7 @@ type data struct { // ResultType is the type of Result (matrix, vector, etc.). ResultType string // Result contains the query result (concrete type depends on ResultType). - Result result + Result result } type result interface { @@ -169,7 +169,7 @@ type Values []Value type Value []interface{} func (t *Tags) genID() string { - tags := make(sort.StringSlice, len(*t)) + tags := make(sort.StringSlice, 0, len(*t)) for k, v := range *t { tags = append(tags, fmt.Sprintf("%s:%s,", k, v)) }