Skip to content

Commit

Permalink
Use min/max funcs from Go SDK
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer buringerst@vmware.com
  • Loading branch information
sbueringer committed Feb 15, 2024
1 parent 31897b5 commit 3aa048b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/services/vimmachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"k8s.io/apimachinery/pkg/types"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/klog/v2"
"k8s.io/utils/integer"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterutilv1 "sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/conditions"
Expand Down Expand Up @@ -450,7 +450,7 @@ func (v *VimMachineService) generateOverrideFunc(ctx context.Context, vimMachine
func overrideNetworkDeviceSpecs(deviceSpecs []infrav1.NetworkDeviceSpec, networks []string) []infrav1.NetworkDeviceSpec {
index, length := 0, len(networks)

devices := make([]infrav1.NetworkDeviceSpec, 0, integer.IntMax(length, len(deviceSpecs)))
devices := make([]infrav1.NetworkDeviceSpec, 0, max(length, len(deviceSpecs)))
// override the networks on the VM spec with placement constraint network definitions
for i := range deviceSpecs {
vmNetworkDeviceSpec := deviceSpecs[i]
Expand Down
3 changes: 1 addition & 2 deletions pkg/util/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
apitypes "k8s.io/apimachinery/pkg/types"
"k8s.io/utils/integer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down Expand Up @@ -93,7 +92,7 @@ func IsControlPlaneMachine(machine metav1.Object) bool {
// IPAM state includes IP and Gateways that should be added to each device.
func GetMachineMetadata(hostname string, vsphereVM infrav1.VSphereVM, ipamState map[string]infrav1.NetworkDeviceSpec, networkStatuses ...infrav1.NetworkStatus) ([]byte, error) {
// Create a copy of the devices and add their MAC addresses from a network status.
devices := make([]infrav1.NetworkDeviceSpec, integer.IntMax(len(vsphereVM.Spec.Network.Devices), len(networkStatuses)))
devices := make([]infrav1.NetworkDeviceSpec, max(len(vsphereVM.Spec.Network.Devices), len(networkStatuses)))

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / coverage

max requires go1.21 or later (-lang was set to go1.20; check go.mod)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

Check failure on line 95 in pkg/util/machines.go

View workflow job for this annotation

GitHub Actions / lint

max requires go1.21 or later (-lang was set to go1.20; check go.mod)) (typecheck)

var waitForIPv4, waitForIPv6 bool
for i := range vsphereVM.Spec.Network.Devices {
Expand Down

0 comments on commit 3aa048b

Please sign in to comment.