-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Enable nilerr, nilnesserr #4346
base: main
Are you sure you want to change the base?
chore: Enable nilerr, nilnesserr #4346
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: alexandear The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @alexandear. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-kueue ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/ok-to-test |
/assign |
@@ -400,7 +400,7 @@ func (c *clustersReconciler) Reconcile(ctx context.Context, req reconcile.Reques | |||
|
|||
if err != nil || !cluster.DeletionTimestamp.IsZero() { | |||
c.stopAndRemoveCluster(req.Name) | |||
return reconcile.Result{}, nil | |||
return reconcile.Result{}, client.IgnoreNotFound(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that returning nil here is intentional, as either the cluster is deleted, or not found (since the only err that will cause us to hit this branch is NotFound
). If we return an error, I think we will repeatedly keep trying to process this deleted or not found cluster.
Is there a possible refactor that will make this more readable, and make the linter happy?
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Enable
nilerr
andnilnesserr
linters to find places where returningnil
may be wrong.nilerr
finds places that return nil even if it checks that the error is not nil.nilnesserr
reports constructs that checks for err != nil, but returns a different nil value error.Special notes for your reviewer:
The
nilerr
linter founds two places whereerr
is notnil
, but returned value isnil
:clustersReconciler.Reconcile
:Returning
nil
is expected becauseerr
isNotFound
and we ignore it. To silence the linter, I changednil
toclient.IgnoreNotFound(err)
.JobSet.RunWithPodSetsInfo
:I suspect there is a bug here, and I changed to return
err
.Does this PR introduce a user-facing change?