Provides capacity for make slice

* Providing capacity for slice decreases memory allocations performed
This commit is contained in:
rkilingr 2021-01-31 20:56:11 +05:30
parent c241a237f9
commit dfe29ae7f8
No known key found for this signature in database
GPG Key ID: 47D29311AEB6F0A7

View File

@ -86,7 +86,7 @@ func (l *PodDeleteList) errors() []error {
failedPods[msg] = append(failedPods[msg], fmt.Sprintf("%s/%s", i.Pod.Namespace, i.Pod.Name))
}
}
errs := make([]error, 0)
errs := make([]error, 0, len(failedPods))
for msg, pods := range failedPods {
errs = append(errs, fmt.Errorf("cannot delete %s: %s", msg, strings.Join(pods, ", ")))
}