Skip to content
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

golangci-lint warnings #4439

Open
JamieMagee opened this issue Dec 6, 2024 · 2 comments · May be fixed by #4546
Open

golangci-lint warnings #4439

JamieMagee opened this issue Dec 6, 2024 · 2 comments · May be fixed by #4546
Labels

Comments

@JamieMagee
Copy link
Contributor

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
@spencerschrock
Copy link
Member

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

Copy link

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

@github-actions github-actions bot added the Stale label Feb 11, 2025
spencerschrock added a commit to spencerschrock/scorecard that referenced this issue Mar 3, 2025
Disable all the checks, then turn the ones we want on one-by-one. This
list matches what we already had in the config, plus the checks which
are enabled by default. The end result is the same list of linters, but
we silence the warnings reported in ossf#4439.

Signed-off-by: Spencer Schrock <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants