Skip to content

Switch to golangci-lint v2 #2440

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
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

helsaawy
Copy link
Contributor

v1 is deprecated, and golangci/golangci-lint-action@v8 requires v2.1+.

Use golangci-lint migrate to switch to v2 settings and remove outdated/deprecated settings.

Ignore nil pointer lints for tests, since the linter doesn't handle t.Fatal appropriately.

Fix various new lint issues, mostly staticcheck quick fixes (via golangci-ling --fix):

  • embedded field selector
  • simplify conditionals via De Morgan
  • replace strings.Replace(_, _, _, -1) with strings.ReplaceAll()
  • switch if/else-if to switch
  • move conditional into infinite for loops
  • omit unnecessary type declaration

See #2427

helsaawy added 2 commits May 27, 2025 22:14
v1 is deprecated, and `golangci/golangci-lint-action@v8` requires v2.1+.

Use `golangci-lint migrate` to switch to v2 settings and remove
outdated/deprecated settings.

Ignore `nil` pointer lints for tests, since the linter doesn't handle
`t.Fatal` appropriately.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Various new lint issues, mostly staticcheck quick fixes (via
`golangci-ling --fix`):
 - embedded field selector
 - simplify conditionals via De Morgan
 - replace `strings.Replace(_, _, _, -1)` with `strings.ReplaceAll()`
 - switch `if/else-if` to `switch`
 - move conditional into infinite `for` loops
 - omit unnecessary type declaration

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
@helsaawy helsaawy requested a review from a team as a code owner May 28, 2025 14:58
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.

3 participants