Skip to content

Conversation

@diatrcz
Copy link

@diatrcz diatrcz commented Oct 16, 2025

Migrate golangci-lint to v2 from v1.

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2025

CLA assistant check
All committers have signed the CLA.

@diatrcz diatrcz marked this pull request as ready for review October 16, 2025 08:47
@diatrcz diatrcz requested a review from pyrooka October 16, 2025 08:47
@pyrooka pyrooka changed the title build(deps): migrate golanci-lint build: migrate golangci-lint to v2 Oct 17, 2025
@diatrcz diatrcz marked this pull request as draft October 17, 2025 16:14
@diatrcz diatrcz marked this pull request as ready for review October 20, 2025 12:05
Copy link
Member

@pyrooka pyrooka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments to consider. Haven't tested all of them so expect lint failures, but we should keep things default and as strict as possible. Let me know if you have any questions!

These comments/suggestions also apply to IBM/platform-services-go-sdk#411

.golangci.yaml Outdated
Comment on lines 5 to 6
disable:
- staticcheck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into the changelog of golangci-lint and found this:

⚠️ Merge staticcheck, stylecheck, gosimple into one linter (staticcheck) (cf. Migration guide)

So after thinking about this a little I have to realize that completely disabling staticcheck is not a good idea as we also disable the other 2 - sorry for suggesting this previously! :)

Sooo, I'd recommend to disable only the rules that cause issues. I've found 2 ways to do that:

  1. Setting the check in the staticcheck config (see here )
  2. Ignoring specific messages from the staticcheck linter. Here is an example how to do it (at the bottom of the config in the linked section).

Sorry for the confusion!

Copy link
Author

@diatrcz diatrcz Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the approach of enabling and disabling rules inside the check in the linter's config. Only downside is that this way you have to list every single rule that you want to use with the linter. Although somehow this way it includes more rules with the linter as well. Nevermind I can't read 😅

Signed-off-by: Lídia Tarcza <[email protected]>
Signed-off-by: Lídia Tarcza <[email protected]>
@diatrcz diatrcz requested a review from pyrooka October 22, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants