Skip to content

Commit 8be88aa

Browse files
author
Anand Kumar
committed
fix(unparam): make cleanUp return only bool, error was always nil
Resolve unparam: (*Reconciler).cleanUp result 1 (error) is always nil. Change signature to return bool only and simplify call site. Made-with: Cursor
1 parent cd3d2b0 commit 8be88aa

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

pkg/controller/trustmanager/controller.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
170170
if !trustManager.DeletionTimestamp.IsZero() {
171171
r.log.V(1).Info("trustmanager.openshift.operator.io is marked for deletion", "name", req.NamespacedName)
172172

173-
if requeue, err := r.cleanUp(trustManager); err != nil {
174-
return ctrl.Result{}, fmt.Errorf("clean up failed for %q trustmanager.openshift.operator.io instance deletion: %w", req.NamespacedName, err)
175-
} else if requeue {
173+
if requeue := r.cleanUp(trustManager); requeue {
176174
return ctrl.Result{RequeueAfter: defaultRequeueTime}, nil
177175
}
178176

@@ -210,10 +208,10 @@ func (r *Reconciler) processReconcileRequest(trustManager *v1alpha1.TrustManager
210208
}
211209

212210
// cleanUp handles deletion of trustmanager.openshift.operator.io gracefully.
213-
func (r *Reconciler) cleanUp(trustManager *v1alpha1.TrustManager) (bool, error) {
211+
func (r *Reconciler) cleanUp(trustManager *v1alpha1.TrustManager) bool {
214212
// TODO: For GA, handle cleaning up of resources created for installing trust-manager operand.
215213
// As per Non-Goals in the enhancement, removing the TrustManager CR will not remove the
216214
// trust-manager deployment or its associated resources.
217215
r.eventRecorder.Eventf(trustManager, corev1.EventTypeWarning, "RemoveDeployment", "%s trustmanager marked for deletion, remove all resources created for trustmanager deployment manually", trustManager.GetName())
218-
return false, nil
216+
return false
219217
}

0 commit comments

Comments
 (0)