Skip to content

Fix golangci-lint v2 config - disable default linters#366

Merged
schmidtw merged 1 commit intomainfrom
fix-golangci-v2
Apr 5, 2026
Merged

Fix golangci-lint v2 config - disable default linters#366
schmidtw merged 1 commit intomainfrom
fix-golangci-v2

Conversation

@schmidtw
Copy link
Copy Markdown
Member

@schmidtw schmidtw commented Apr 5, 2026

Summary

This PR fixes the golangci-lint v2 configuration to properly disable default linters and match the original v1 behavior.

Problem

In golangci-lint v2, several linters are enabled by default even if not explicitly listed in the enable section:

  • govet
  • staticcheck
  • unused

This caused many new linting errors that didn't exist with the v1 config.

Solution

Explicitly Disable Default Linters

Added to the disable list:

  • govet
  • staticcheck
  • unused

Configure gosec to Exclude G104

Added gosec settings to exclude G104 (unhandled errors), which is similar to the disabled errcheck linter:

gosec:
  excludes:
    - G104

Results

Before this fix:

  • Many linting errors from staticcheck, govet, and gosec G104

After this fix:

  • Only 1 linting issue: G705 (XSS via taint analysis) in basculehttp/middleware.go:206

Verification

golangci-lint config verify passes
golangci-lint run now produces minimal output matching v1 behavior

- Explicitly disable govet, staticcheck, unused (enabled by default in v2)
- Add gosec.excludes to disable G104 (unhandled errors, similar to errcheck)
- This matches the original v1 behavior more closely
- Reduces linting errors from many to just 1 (G705 XSS warning)
@schmidtw schmidtw added the normalize Repo normalization work label Apr 5, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (9c20e8b) to head (4dfbeba).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #366   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files          30       30           
  Lines         924      924           
=======================================
  Hits          922      922           
  Misses          2        2           
Flag Coverage Δ
unittests 99.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@schmidtw schmidtw merged commit 5c7fbd2 into main Apr 5, 2026
19 checks passed
@schmidtw schmidtw deleted the fix-golangci-v2 branch April 5, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

normalize Repo normalization work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants