scorecard icon indicating copy to clipboard operation
scorecard copied to clipboard

golangci-lint warnings

Open JamieMagee opened this issue 1 year ago • 3 comments

Running golangci-lint, either locally or in GitHub Actions, outputs a lot of warnings:

WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.
WARN [linters_context] gocritic: no need to enable check "appendAssign": it's already enabled
WARN [linters_context] gocritic: no need to enable check "badCond": it's already enabled
WARN [linters_context] gocritic: no need to enable check "caseOrder": it's already enabled
WARN [linters_context] gocritic: no need to enable check "codegenComment": it's already enabled
WARN [linters_context] gocritic: no need to enable check "deprecatedComment": it's already enabled
WARN [linters_context] gocritic: no need to enable check "dupBranchBody": it's already enabled
WARN [linters_context] gocritic: no need to enable check "dupCase": it's already enabled
WARN [linters_context] gocritic: no need to enable check "dupSubExpr": it's already enabled
WARN [linters_context] gocritic: no need to enable check "exitAfterDefer": it's already enabled
WARN [linters_context] gocritic: no need to enable check "flagName": it's already enabled
WARN [linters_context] gocritic: no need to enable check "captLocal": it's already enabled
WARN [linters_context] gocritic: no need to enable check "commentFormatting": it's already enabled
WARN [linters_context] gocritic: no need to enable check "defaultCaseOrder": it's already enabled
WARN [linters_context] gocritic: no need to enable check "elseif": it's already enabled
WARN [linters_context] gocritic: no need to enable check "ifElseChain": it's already enabled
WARN [linters_context] gocritic: no need to enable check "singleCaseSwitch": it's already enabled
WARN [linters_context] gocritic: no need to enable check "typeSwitchVar": it's already enabled
WARN [linters_context] gocritic: no need to enable check "underef": it's already enabled
WARN [linters_context] gocritic: no need to enable check "unlambda": it's already enabled

JamieMagee avatar Dec 06 '24 16:12 JamieMagee

using copyloopvar will likely be a larger diff since we declare 1.22 in our go.mod, so my guess is it will want all of our tt := tt gone (maybe make fix-linter can auto fix it).

for gocritic, it's kind of annoying that it warns for that, but we can explore https://golangci-lint.run/usage/linters/#gocritic:

  • using disable-all
  • using presets
  • just deleting the rules it's complaining about being enabled already

spencerschrock avatar Dec 11 '24 22:12 spencerschrock

This issue has been marked stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Feb 11 '25 01:02 github-actions[bot]

commandeering this issue for a few other linters todo in #4641

spencerschrock avatar Sep 04 '25 17:09 spencerschrock