Skip to content

Upgrade golangci-lint v1.61.0 → v2.11.1 and fix all lint issues#308

Open
gavins-db wants to merge 9 commits intodatabricks:db_mainfrom
gavins-db:gs/lint-copyloopvar
Open

Upgrade golangci-lint v1.61.0 → v2.11.1 and fix all lint issues#308
gavins-db wants to merge 9 commits intodatabricks:db_mainfrom
gavins-db:gs/lint-copyloopvar

Conversation

@gavins-db
Copy link

@gavins-db gavins-db commented Mar 6, 2026

Current golangci-lint is VERY out of date and generates many false positives. This PR updates the linter and makes the appropriate fixes.

Making this change will unblock a few other things such as

  1. upgrading go in general to make use of greentea GC
  2. enabling various efficiency fixes such as auto rewrite of fmt.Sprintf uses to more efficient variants.
  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

  • Migrate .golangci.yml from v1 to v2 config format
  • Replace deprecated exportloopref with copyloopvar; remove 16 unnecessary loop variable copies
  • Fix 39+ auto-fixable lint issues (QF1003, QF1007, QF1008, QF1011, QF1012, ST1023, QF1001)
  • Fix duplicate streamer import (ST1019), error var naming (ST1012), error string formatting (ST1005)
  • Rename defaultMaxResolutionSeconds → defaultMaxResolution (ST1011)
  • Remove malformed json tag on embedded TSDBStatus field (SA5008)
  • Simplify De Morgan's expression in fetcher_test.go (QF1001)
  • Update bingo to install golangci-lint v2.11.1
  • Add .vscode/ to .gitignore
  • Migrate all faillint banned-import rules to depguard (pkg-level bans)
  • Migrate all faillint banned-function rules to forbidigo
  • Remove faillint from Makefile go-lint target
  • make go-format uses golangci-lint
  • adds missing make lint-fix command to automatically fix fixable lints.

Verification

  • make lint now actually works 🎉

yuchen-db and others added 9 commits March 3, 2026 15:14
- Migrate .golangci.yml from v1 to v2 config format
- Replace deprecated exportloopref with copyloopvar; remove 16 unnecessary loop variable copies
- Fix 39+ auto-fixable lint issues (QF1003, QF1007, QF1008, QF1011, QF1012, ST1023, QF1001)
- Fix duplicate streamer import (ST1019), error var naming (ST1012), error string formatting (ST1005)
- Rename defaultMaxResolutionSeconds → defaultMaxResolution (ST1011)
- Remove malformed json tag on embedded TSDBStatus field (SA5008)
- Simplify De Morgan's expression in fetcher_test.go (QF1001)
- Update bingo to install golangci-lint v2.11.1
- Add .vscode/ to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Migrate all faillint banned-import rules to depguard (pkg-level bans)
- Migrate all faillint banned-function rules to forbidigo with analyze-types
  and pkg field for alias-safe matching
- Remove faillint from Makefile go-lint target
- Fix examples path exclusion (examples → ^examples/) to avoid matching filenames

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gavins-db
Copy link
Author

humm.. it's come to my attention that upstream thanos has already updated their lint and moved to go 1.25. I will close this and reassess... perhaps I need to pull in upstream changes into db_main instead.

@gavins-db gavins-db closed this Mar 9, 2026
@gavins-db
Copy link
Author

on second thought, I'll reopen, the db_main is so diverged from oss thanos that cherry-picking specific commits is a challenge. But I'll speaking with others and get their opinion offline.

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.

2 participants