diff --git a/controller/linodemachine_controller.go b/controller/linodemachine_controller.go index b77d9c9f9..a960305ca 100644 --- a/controller/linodemachine_controller.go +++ b/controller/linodemachine_controller.go @@ -191,7 +191,6 @@ func (r *LinodeMachineReconciler) reconcile( machineScope.LinodeMachine.Status.FailureMessage = util.Pointer("") failureReason := cerrs.MachineStatusError("UnknownError") - //nolint:dupl // Code duplication is simplicity in this case. defer func() { if err != nil { machineScope.LinodeMachine.Status.FailureReason = util.Pointer(failureReason) diff --git a/controller/linodemachine_controller_helpers.go b/controller/linodemachine_controller_helpers.go index 17d68bee9..666858cf5 100644 --- a/controller/linodemachine_controller_helpers.go +++ b/controller/linodemachine_controller_helpers.go @@ -188,14 +188,11 @@ func (r *LinodeMachineReconciler) getVPCInterfaceConfig(ctx context.Context, mac return nil, err default: // Place node into the least busy subnet - sortedSubnets := make([]linodego.VPCSubnet, len(vpc.Subnets)) - copy(sortedSubnets, vpc.Subnets) - - sort.Slice(sortedSubnets, func(i, j int) bool { - return len(sortedSubnets[i].Linodes) > len(sortedSubnets[j].Linodes) + sort.Slice(vpc.Subnets, func(i, j int) bool { + return len(vpc.Subnets[i].Linodes) > len(vpc.Subnets[j].Linodes) }) - subnetID = sortedSubnets[0].ID + subnetID = vpc.Subnets[0].ID } return &linodego.InstanceConfigInterfaceCreateOptions{ diff --git a/controller/linodevpc_controller.go b/controller/linodevpc_controller.go index e8b1809a0..439b92f7f 100644 --- a/controller/linodevpc_controller.go +++ b/controller/linodevpc_controller.go @@ -108,7 +108,6 @@ func (r *LinodeVPCReconciler) reconcile( vpcScope.LinodeVPC.Status.FailureMessage = util.Pointer("") failureReason := infrav1.VPCStatusError("UnknownError") - //nolint:dupl // Code duplication is simplicity in this case. defer func() { if err != nil { vpcScope.LinodeVPC.Status.FailureReason = util.Pointer(failureReason)