nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

Refactor code to enable some lint checks

Open ChengyuZhu6 opened this issue 5 months ago • 10 comments

After upgrading golangci-lint to v2.4.0 (2025-08-14), CI started failing:

https://github.com/containerd/nerdctl/actions/runs/17294879972/job/49090536229?pr=4490 https://github.com/containerd/nerdctl/actions/runs/17294879986/job/49090535739?pr=4490

As a temporary workaround, we’ve disabled the following linters:

        - name: redundant-test-main-exit
          disabled: true
        - name: enforce-switch-style
          disabled: true
        - name: var-naming
          disabled: true

We need refactor code to re-enabe these checks.

Details: https://github.com/containerd/nerdctl/pull/4490

ChengyuZhu6 avatar Aug 29 '25 07:08 ChengyuZhu6

cc @AkihiroSuda

ChengyuZhu6 avatar Aug 29 '25 07:08 ChengyuZhu6

See also https://github.com/containerd/nerdctl/blob/741dd8750aa615cd5a0350994c905b9d23a7baa8/.golangci.yml#L83-L189

AkihiroSuda avatar Aug 29 '25 07:08 AkihiroSuda

Hey @AkihiroSuda! Can I take this up?

Also, would it make sense to break it into multiple PRs to reduce code churn?

wandering-salesman avatar Aug 29 '25 19:08 wandering-salesman

Yes, thanks

This should be multiple PRs

AkihiroSuda avatar Aug 29 '25 20:08 AkihiroSuda

Hey @AkihiroSuda! I've added the first PR #4496

var-naming linter would need a decision, we use utils & types as package names, but they are discouraged for being too vague.

wandering-salesman avatar Aug 31 '25 18:08 wandering-salesman

I'll start from these ones in the next PR https://github.com/containerd/nerdctl/blob/8d3ad046ca17f67086e8ccfba5f9a7137e73e327/.golangci.yml#L83-L104

wandering-salesman avatar Aug 31 '25 18:08 wandering-salesman

Hi! Me, @ShivanshNikhra, and @aravsrid are a group of three students working on open-source issues for our virtualization course. We’re interested in taking on this issue and coordinating the work among ourselves to submit a single PR for one of the lint checks.

We estimate we can complete it within the next month. Would it be okay if we proceed with this issue? If you prefer assignments, we’re happy to be assigned as well. Thanks!

yashkukrecha avatar Nov 11 '25 20:11 yashkukrecha

Would it be okay if we proceed with this issue?

Feel free to work on any issue you like, but I'm not sure if fixing lint issues is the right task for your school assignment. I suggest asking your professor.

AkihiroSuda avatar Nov 11 '25 22:11 AkihiroSuda

Our professor wants us to work on any virtualization-related open-source repositories. We have his approval to work on the issues I've commented on. Is there any chance these issues could be assigned to us? Thanks!

yashkukrecha avatar Nov 11 '25 22:11 yashkukrecha

Hi @AkihiroSuda! Sorry for the spam, but thanks for assigning us to this issue.

For our course, we’re planning to work on a few other issues as well:

  • https://github.com/containerd/nerdctl/issues/4595
  • https://github.com/containerd/nerdctl/issues/4262
  • https://github.com/containerd/nerdctl/issues/4338
  • https://github.com/containerd/nerdctl/issues/3751

Would it be alright if we were assigned these as well? Thanks again for your time and help!

yashkukrecha avatar Nov 12 '25 04:11 yashkukrecha