-
Notifications
You must be signed in to change notification settings - Fork 920
GODRIVER-3670 Run golangci-lint CLI migration #2250
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
base: master
Are you sure you want to change the base?
GODRIVER-3670 Run golangci-lint CLI migration #2250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR upgrades golangci-lint from v1.60.1 to v2.6.2 and updates the configuration to align with the v2 CLI format. The changes apply automated linter fixes across the codebase, including removing deprecated build tags, improving code clarity, and addressing revive and staticcheck warnings.
Key Changes:
- Migrated golangci-lint configuration from v1 to v2 format
- Removed legacy
// +buildtags (now redundant with//go:build) - Applied automated code improvements suggested by linters (variable naming, boolean logic simplification, etc.)
Reviewed changes
Copilot reviewed 77 out of 77 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| .golangci.yml | Migrated config to v2 format with updated linter settings and exclusion rules |
| etc/golangci-lint.sh | Updated golangci-lint version to 2.6.2 |
| Multiple build tag files | Removed deprecated // +build tags across ~30 files |
| x/mongo/driver/topology/*.go | Fixed variable naming, simplified boolean expressions, removed blank lines |
| x/mongo/driver/session/client_session.go | Converted if-else chains to switch statements |
| x/mongo/driver/operation*.go | Simplified boolean logic with De Morgan's laws |
| x/bsonx/bsoncore/*.go | Changed objectID type to explicit [12]byte array |
| mongo/*.go | Renamed variables for clarity (Db→DB, MS→Time suffixes) |
| internal/integration/*.go | Updated test database naming and simplified loop conditions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
90f7916 to
5b4050c
Compare
API Change ReportNo changes found! |
|
Rejecting all AI suggestions that conflict with the golangci-lint static analysis |
🧪 Performance ResultsCommit SHA: 5b4050cThe following benchmark tests for version 69278162867a2d0007aa97b7 had statistically significant changes (i.e., |z-score| > 1.96):
For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
GODRIVER-3670
Summary
Upgrade golangci-lint usage and config to the current CLI, then applies linter-driven fixes across the repo. Clean up revive “unexported-return” issues and staticcheck warnings, grouped by package.
gosec issues are being tracked in #2245 due to complexity
Background & Motivation
golangci-lint is failing for reasons unknown to the golangci-lint team.