Skip to content

Bump to golangci-lint v2 #12087

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

Open
sivchari opened this issue Apr 11, 2025 · 4 comments · May be fixed by #12088
Open

Bump to golangci-lint v2 #12087

sivchari opened this issue Apr 11, 2025 · 4 comments · May be fixed by #12088
Assignees
Labels
area/ci Issues or PRs related to ci help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. needs-priority Indicates an issue lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@sivchari
Copy link
Member

sivchari commented Apr 11, 2025

golangci-lint v2 has already been launched. So let's migrate it from v1 to v2 .

The official documentation is broken (I don't know why it is broken), so I pasted the link of author's blog.
ref: https://ldez.github.io/blog/2025/03/23/golangci-lint-v2/

/area ci
/kind feature
/help

@k8s-ci-robot
Copy link
Contributor

@sivchari:
This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

golangci-lint v2 has already been launched. So let's migrate it from v1 to v2 .

/area ci
/kind feature
/help

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.

@k8s-ci-robot k8s-ci-robot added area/ci Issues or PRs related to ci help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. needs-priority Indicates an issue lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 11, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If CAPI contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@chrischdi
Copy link
Member

Yeah, we should tackle this at some point.

Golangci-lint did a great job in helping by adding a migration command.

However it needs some manual work to:

  • preserve our comments
  • take a look what changes.

Findings on a first view:

  • removed linters
    • tenv # using os.Setenv instead of t.Setenv in test
  • linters merged into staticcheck
    • stylecheck
    • gosimple
  • not linters, but formatters now:
    • gci # ensures imports are organized
    • gofmt # warns about incorrect use of fmt functions
    • goimports # import formatting

In best case we get this done without any findings to fix, while not having to add new exclusions.

@sivchari
Copy link
Member Author

golangci-lint provides migration guide, so almost migration will be done to use it. And we can replace tenv analyzer with usetesting analyzer.
I'll tackle it.
/assign

@sivchari sivchari linked a pull request Apr 12, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Issues or PRs related to ci help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. needs-priority Indicates an issue lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants