diff --git a/controllers/backup_controller.go b/controllers/backup_controller.go index abd390d..abaaff8 100644 --- a/controllers/backup_controller.go +++ b/controllers/backup_controller.go @@ -172,14 +172,14 @@ func (r *BackupReconciler) SetupWithManager(mgr ctrl.Manager) error { // filter the changes in workflow status // let workflow handle its reconcile UpdateFunc: func(e ctrlEvent.UpdateEvent) bool { - new := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun) - old := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun) + newObj := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun) + oldObj := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun) // if the workflow is not finished, skip the reconcile - if !new.Status.Finished { + if !newObj.Status.Finished { return false } - return !reflect.DeepEqual(old, new) + return !reflect.DeepEqual(oldObj, newObj) }, CreateFunc: func(e ctrlEvent.CreateEvent) bool { run := e.Object.DeepCopyObject().(*v1alpha1.WorkflowRun) diff --git a/controllers/workflowrun_controller.go b/controllers/workflowrun_controller.go index 9660d40..bad0c2e 100644 --- a/controllers/workflowrun_controller.go +++ b/controllers/workflowrun_controller.go @@ -216,8 +216,8 @@ func (r *WorkflowRunReconciler) SetupWithManager(mgr ctrl.Manager) error { // filter the changes in workflow status // let workflow handle its reconcile UpdateFunc: func(e ctrlEvent.UpdateEvent) bool { - new, isNewWR := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun) - old, isOldWR := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun) + newObj, isNewWR := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun) + oldObj, isOldWR := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun) // if the object is a event listener, reconcile the controller if !isNewWR || !isOldWR { @@ -225,26 +225,26 @@ func (r *WorkflowRunReconciler) SetupWithManager(mgr ctrl.Manager) error { } // if the workflow is finished, skip the reconcile - if new.Status.Finished { + if newObj.Status.Finished { return false } // filter managedFields changes - old.ManagedFields = nil - new.ManagedFields = nil + oldObj.ManagedFields = nil + newObj.ManagedFields = nil // filter resourceVersion changes - old.ResourceVersion = new.ResourceVersion + oldObj.ResourceVersion = newObj.ResourceVersion // if the generation is changed, return true to let the controller handle it - if old.Generation != new.Generation { + if oldObj.Generation != newObj.Generation { return true } // ignore the changes in step status - old.Status.Steps = new.Status.Steps + oldObj.Status.Steps = newObj.Status.Steps - return !reflect.DeepEqual(old, new) + return !reflect.DeepEqual(oldObj, newObj) }, CreateFunc: func(e ctrlEvent.CreateEvent) bool { //nolint:revive,unused return true diff --git a/pkg/utils/recycle.go b/pkg/utils/recycle.go index 8634a40..475df03 100644 --- a/pkg/utils/recycle.go +++ b/pkg/utils/recycle.go @@ -69,7 +69,7 @@ func (r *recycleCronJob) start(ctx context.Context) (*cron.Cron, error) { Duration: 1 * time.Minute, Factor: 5.0, Jitter: 0.1, - }, func(err error) bool { + }, func(err error) bool { //nolint:revive,unused // always retry return true }, func() error {