fix: Give accurate cap to slice (#17224)

This commit is contained in:
drivebyer 2023-05-18 06:14:09 +08:00 committed by GitHub
parent f037c9b286
commit ad2ab6eb3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2677,8 +2677,8 @@ func (c *minioNodeCollector) Collect(ch chan<- prometheus.Metric) {
}
func getOrderedLabelValueArrays(labelsWithValue map[string]string) (labels, values []string) {
labels = make([]string, 0)
values = make([]string, 0)
labels = make([]string, 0, len(labelsWithValue))
values = make([]string, 0, len(labelsWithValue))
for l, v := range labelsWithValue {
labels = append(labels, l)
values = append(values, v)