Skip to content

Conversation

@prestonvasquez
Copy link
Member

@prestonvasquez prestonvasquez commented Nov 26, 2025

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.

Copilot AI review requested due to automatic review settings November 26, 2025 22:34
@prestonvasquez prestonvasquez requested a review from a team as a code owner November 26, 2025 22:34
@github-actions github-actions bot added the review-priority-normal Medium Priority PR for Review: within 1 business day label Nov 26, 2025
@prestonvasquez prestonvasquez added ci/cd review-priority-urgent High Priority PR for Review: review immediately! and removed review-priority-normal Medium Priority PR for Review: within 1 business day labels Nov 26, 2025
Copy link
Contributor

Copilot AI left a 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 // +build tags (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.

@prestonvasquez prestonvasquez force-pushed the cicd/godriver-3670-update-golangci-lint-v2.6.2-migration branch from 90f7916 to 5b4050c Compare November 26, 2025 22:38
@github-actions github-actions bot added the review-priority-normal Medium Priority PR for Review: within 1 business day label Nov 26, 2025
@mongodb-drivers-pr-bot
Copy link
Contributor

API Change Report

No changes found!

@prestonvasquez
Copy link
Member Author

Rejecting all AI suggestions that conflict with the golangci-lint static analysis --fix flag.

@mongodb-drivers-pr-bot
Copy link
Contributor

🧪 Performance Results

Commit SHA: 5b4050c

The following benchmark tests for version 69278162867a2d0007aa97b7 had statistically significant changes (i.e., |z-score| > 1.96):

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkMultiFindMany ops_per_second_min -87.7627 4230.4406 Avg: 34569.9551
Med: 34572.9443
Stdev: 15135.9279
0.7169 -2.0045
BenchmarkBSONFullDocumentEncoding total_mem_allocs 2.8880 1579568.0000 Avg: 1535231.1176
Med: 1532839.0000
Stdev: 16903.4213
0.7908 2.6230
BenchmarkBSONFullDocumentEncoding total_bytes_allocated 2.8775 273233736.0000 Avg: 265591273.4118
Med: 265291880.0000
Stdev: 2896393.3976
0.7919 2.6386

For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd review-priority-normal Medium Priority PR for Review: within 1 business day review-priority-urgent High Priority PR for Review: review immediately!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant