Skip to content

Commit

Permalink
fix: pre alloc silice.
Browse files Browse the repository at this point in the history
  • Loading branch information
kycheng committed Jul 10, 2023
1 parent 32fdf63 commit 33c00f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion resource/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func SumResources(resources ...corev1.ResourceRequirements) corev1.ResourceRequi
return corev1.ResourceRequirements{}
}

var sumLimits, sumRequests []corev1.ResourceList
sumLimits := make([]corev1.ResourceList, 0, len(resources))
sumRequests := make([]corev1.ResourceList, 0, len(resources))
for _, item := range resources {
sumLimits = append(sumLimits, item.Limits)
sumRequests = append(sumRequests, item.Requests)
Expand Down

0 comments on commit 33c00f8

Please sign in to comment.