Skip to content

ci: Enable modernize golangci-lint linter#42642

Merged
tklauser merged 6 commits intomainfrom
pr/HadrienPatte/golangci-lint-modernize
Nov 10, 2025
Merged

ci: Enable modernize golangci-lint linter#42642
tklauser merged 6 commits intomainfrom
pr/HadrienPatte/golangci-lint-modernize

Conversation

@HadrienPatte
Copy link
Copy Markdown
Member

Followup to #42525

This PR enables the new modernize golangci-lint linter that's available since golangci-lint 2.6.0 (#42514).

This PR includes fixes for the following modernize analyzers that would currently be failing:

  • stringsseq: Ranging over SplitSeq is more efficient
  • stringscutprefix: HasPrefix + TrimPrefix can be simplified to CutPrefix
  • reflecttypefor: reflect.TypeOf call can be simplified using TypeFor
  • any: interface{} can be replaced by any
  • minmax: if statement can be modernized using min

The following modernize analyzers are currently disabled as fixing them would cause a larger diff and should be done in separate PRs:

  • omitzero
  • rangeint
  • stringsbuilder
  • waitgroup

Ranging over SplitSeq is more efficient

Signed-off-by: Hadrien Patte <[email protected]>
HasPrefix + TrimPrefix can be simplified to CutPrefix

Signed-off-by: Hadrien Patte <[email protected]>
reflect.TypeOf call can be simplified using TypeFor

Signed-off-by: Hadrien Patte <[email protected]>
interface{} can be replaced by any

Signed-off-by: Hadrien Patte <[email protected]>
if statement can be modernized using min

Signed-off-by: Hadrien Patte <[email protected]>
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Nov 6, 2025
@HadrienPatte HadrienPatte changed the title ci: Enable modernize golangci-lint linter ci: Enable modernize golangci-lint linter Nov 6, 2025
@github-actions github-actions bot added the sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. label Nov 6, 2025
@HadrienPatte HadrienPatte marked this pull request as ready for review November 6, 2025 17:12
@HadrienPatte HadrienPatte requested review from a team as code owners November 6, 2025 17:12
Copy link
Copy Markdown
Member

@fristonio fristonio left a comment

Choose a reason for hiding this comment

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

🚀

@fristonio fristonio added the release-note/misc This PR makes changes that have no direct user impact. label Nov 6, 2025
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Nov 6, 2025
Copy link
Copy Markdown
Contributor

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@HadrienPatte Nice work!

@tklauser
Copy link
Copy Markdown
Member

tklauser commented Nov 7, 2025

/test

@tklauser tklauser enabled auto-merge November 7, 2025 11:35
@tklauser tklauser added this pull request to the merge queue Nov 10, 2025
Merged via the queue into main with commit 297c097 Nov 10, 2025
390 of 392 checks passed
@tklauser tklauser deleted the pr/HadrienPatte/golangci-lint-modernize branch November 10, 2025 19:31
@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Nov 10, 2025
@cilium-release-bot cilium-release-bot bot moved this to Released in cilium v1.19.0 Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.

Projects

No open projects
Status: Released

Development

Successfully merging this pull request may close these issues.

10 participants