Skip to content

Commit 12d2834

Browse files
Copilotrejain456
andcommitted
Fix gocritic rangeValCopy performance issue in PodIPDemandListener
Co-authored-by: rejain456 <[email protected]>
1 parent 1071531 commit 12d2834

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cns/ipampool/v2/adapter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ func PodIPDemandListener(ch chan<- int) func([]v1.Pod) {
3434
// Filter out Pods in terminal phases (Succeeded/Failed) since they no longer
3535
// have network sandboxes and don't contribute to IP demand
3636
activePods := 0
37-
for _, pod := range pods {
38-
if pod.Status.Phase != v1.PodSucceeded && pod.Status.Phase != v1.PodFailed {
37+
for i := range pods {
38+
if pods[i].Status.Phase != v1.PodSucceeded && pods[i].Status.Phase != v1.PodFailed {
3939
activePods++
4040
}
4141
}

0 commit comments

Comments
 (0)