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/aggregator/client/writer_mgr_test.go b/src/aggregator/client/writer_mgr_test.go index c5a46fd55f..07d2fb6b5e 100644 --- a/src/aggregator/client/writer_mgr_test.go +++ b/src/aggregator/client/writer_mgr_test.go @@ -97,7 +97,7 @@ func TestWriterManagerRemoveInstancesSuccess(t *testing.T) { nonexistent := placement.NewInstance(). SetID("nonexistent"). SetEndpoint("nonexistentAddress") - toRemove := append([]placement.Instance{nonexistent, testPlacementInstance}) + toRemove := []placement.Instance{nonexistent, testPlacementInstance} require.NoError(t, mgr.RemoveInstances(toRemove)) require.Equal(t, 0, len(mgr.writers)) require.True(t, clock.WaitUntil(func() bool { 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 89bbb64c6d..b9b1d70f3a 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 302f9a42f8..badffdd50e 100644 --- a/src/query/api/v1/handler/prometheus/response.go +++ b/src/query/api/v1/handler/prometheus/response.go @@ -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)) }