Skip to content

Commit 5dccb40

Browse files
chore: make linter happy
1 parent 1b63384 commit 5dccb40

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cni/network/invoker_cns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ func configureDefaultAddResult(info *IPResultInfo, addConfig *IPAMAddConfig, add
396396
}
397397

398398
maskLen, _ := ncIPNet.Mask.Size()
399-
info.ncSubnetPrefix = uint8(maskLen)
399+
info.ncSubnetPrefix = uint8(maskLen) //nolint:gosec // length of mask, at most 128
400400
}
401401

402402
ip, ncIPNet, err := net.ParseCIDR(info.podIPAddress + "/" + fmt.Sprint(info.ncSubnetPrefix))

cni/network/invoker_cns_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,11 +2324,11 @@ func Test_configureDefaultAddResult(t *testing.T) {
23242324
t.Fatalf("configureDefaultAddResult due to error: %v", err)
23252325
}
23262326

2327-
require.Equal(t, 1, len(addResult.interfaceInfo))
2328-
require.Equal(t, 1, len(addResult.interfaceInfo["00-15-5D-3D-AD-5D"].IPConfigs))
2327+
require.Len(t, addResult.interfaceInfo, 1)
2328+
require.Len(t, addResult.interfaceInfo["00-15-5D-3D-AD-5D"].IPConfigs, 1)
23292329
require.Equal(t, "10.240.2.10/16", addResult.interfaceInfo["00-15-5D-3D-AD-5D"].IPConfigs[0].Address.String())
23302330
require.Equal(t, "10.240.0.1", addResult.interfaceInfo["00-15-5D-3D-AD-5D"].IPConfigs[0].Gateway.String())
2331-
require.Equal(t, 1, len(addResult.interfaceInfo["00-15-5D-3D-AD-5D"].Routes))
2331+
require.Len(t, addResult.interfaceInfo["00-15-5D-3D-AD-5D"].Routes, 1)
23322332
require.Equal(t, "0.0.0.0/0", addResult.interfaceInfo["00-15-5D-3D-AD-5D"].Routes[0].Dst.String())
23332333
require.Equal(t, "10.240.0.1", addResult.interfaceInfo["00-15-5D-3D-AD-5D"].Routes[0].Gw.String())
23342334
require.Equal(t, cns.InfraNIC, addResult.interfaceInfo["00-15-5D-3D-AD-5D"].NICType)

0 commit comments

Comments
 (0)