Skip to content

Commit

Permalink
Remove lint ignore for gocritic
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDXY committed Sep 27, 2023
1 parent ed46a47 commit 31b7daf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
4 changes: 2 additions & 2 deletions controllers/controllers_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ var (

func TestMain(m *testing.M) {
setup()
defer teardown()
code := m.Run()
os.Exit(code) //nolint:gocritic
teardown()
os.Exit(code)
}

func setup() {
Expand Down
11 changes: 4 additions & 7 deletions controllers/vspheremachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,16 @@ func (r *machineReconciler) reconcileNormal(ctx context.Context, machineCtx capv
return reconcile.Result{}, nil
}

//nolint:gocritic
if r.supervisorBased {
err := r.setVMModifiers(ctx, machineCtx)
if err != nil {
return reconcile.Result{}, err
}
} else {
} else if !machineCtx.GetCluster().Status.InfrastructureReady {
// vmwarev1.VSphereCluster doesn't set Cluster.Status.Ready until the API endpoint is available.
if !machineCtx.GetCluster().Status.InfrastructureReady {
log.Info("Cluster infrastructure is not ready yet")
conditions.MarkFalse(machineCtx.GetVSphereMachine(), infrav1.VMProvisionedCondition, infrav1.WaitingForClusterInfrastructureReason, clusterv1.ConditionSeverityInfo, "")
return reconcile.Result{}, nil
}
log.Info("Cluster infrastructure is not ready yet")
conditions.MarkFalse(machineCtx.GetVSphereMachine(), infrav1.VMProvisionedCondition, infrav1.WaitingForClusterInfrastructureReason, clusterv1.ConditionSeverityInfo, "")
return reconcile.Result{}, nil
}

// Make sure bootstrap data is available and populated.
Expand Down
15 changes: 4 additions & 11 deletions pkg/services/govmomi/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,17 +530,10 @@ func (vms *VMService) getMetadata(ctx *virtualMachineContext) (string, error) {

var metadataBase64 string
for _, ec := range obj.Config.ExtraConfig {
if optVal := ec.GetOptionValue(); optVal != nil {
// TODO(akutz) Using a switch instead of if in case we ever
// want to check the metadata encoding as well.
// Since the image stamped images always use
// base64, it should be okay to not check.
//nolint:gocritic
switch optVal.Key {
case guestInfoKeyMetadata:
if v, ok := optVal.Value.(string); ok {
metadataBase64 = v
}
if optVal := ec.GetOptionValue(); optVal != nil && optVal.Key == guestInfoKeyMetadata {
if v, ok := optVal.Value.(string); ok {
metadataBase64 = v
break

Check warning on line 536 in pkg/services/govmomi/service.go

View check run for this annotation

Codecov / codecov/patch

pkg/services/govmomi/service.go#L533-L536

Added lines #L533 - L536 were not covered by tests
}
}
}
Expand Down

0 comments on commit 31b7daf

Please sign in to comment.