From 177773b5a7088838f26131065b918a6f7fffda90 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Tue, 8 Oct 2024 15:06:38 +0800 Subject: [PATCH] fix: fix slice init length (#5757) Co-authored-by: cui fliter --- pkg/autoscaler/autoscaler/pdplan_autoscaler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/autoscaler/autoscaler/pdplan_autoscaler.go b/pkg/autoscaler/autoscaler/pdplan_autoscaler.go index e623c13880..e6c1fa4a0b 100644 --- a/pkg/autoscaler/autoscaler/pdplan_autoscaler.go +++ b/pkg/autoscaler/autoscaler/pdplan_autoscaler.go @@ -32,7 +32,7 @@ import ( const groupLabelKey = "group" func (am *autoScalerManager) getAutoScaledClusters(tac *v1alpha1.TidbClusterAutoScaler, components []v1alpha1.MemberType) (tcList []*v1alpha1.TidbCluster, err error) { - componentStrings := make([]string, len(components)) + componentStrings := make([]string, 0, len(components)) for _, component := range components { componentStrings = append(componentStrings, component.String()) }