Skip to content

Commit 7b00941

Browse files
authored
Use go mod 1.22 way of range over integer syntax (#120)
Signed-off-by: lubronzhan <[email protected]>
1 parent f227e40 commit 7b00941

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/ipam/ipam.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ func FindAvailableHostFromCidr(namespace, cidr string, inUseIPSet *netipx.IPSet,
155155
func FindFreeAddress(poolIPSet *netipx.IPSet, inUseIPSet *netipx.IPSet, descOrder bool) (netip.Addr, error) {
156156
if descOrder {
157157
ipranges := poolIPSet.Ranges()
158-
for i := len(ipranges) - 1; i >= 0; i-- {
159-
iprange := ipranges[i]
158+
for i := range len(ipranges) - 1 {
159+
iprange := ipranges[len(ipranges)-1-i]
160160
ip := iprange.To()
161161
for {
162162
if !inUseIPSet.Contains(ip) && (!ip.Is4() || !isNetworkIDOrBroadcastIP(ip.As4())) {

0 commit comments

Comments
 (0)