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 unclear reasons.

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

mongodb-drivers-pr-bot bot commented Nov 26, 2025

🧪 Performance Results

Commit SHA: 423b421

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

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkBSONDeepDocumentDecoding ops_per_second_min -48.5941 1032.0951 Avg: 2007.7362
Med: 2008.1934
Stdev: 171.2408
0.9118 -5.6975
BenchmarkSmallDocInsertOne total_time_seconds -5.8379 1.1149 Avg: 1.1841
Med: 1.1847
Stdev: 0.0243
0.8147 -2.8458
BenchmarkBSONDeepDocumentDecoding total_mem_allocs -2.2651 12841321.0000 Avg: 13138933.9412
Med: 13173516.0000
Stdev: 135823.8667
0.7531 -2.1912
BenchmarkBSONDeepDocumentDecoding total_bytes_allocated -2.2583 279005152.0000 Avg: 285451439.5294
Med: 286201912.0000
Stdev: 2942934.7907
0.7530 -2.1904
BenchmarkBSONFullDocumentEncoding allocated_bytes_per_op 0.0690 5201.0000 Avg: 5197.4118
Med: 5197.0000
Stdev: 1.3720
0.7917 2.6154

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

@prestonvasquez prestonvasquez force-pushed the cicd/godriver-3670-update-golangci-lint-v2.6.2-migration branch from 5b4050c to 423b421 Compare December 1, 2025 16:57
@prestonvasquez prestonvasquez merged commit 23e3cbc into mongodb:master Dec 1, 2025
35 checks passed
@prestonvasquez prestonvasquez deleted the cicd/godriver-3670-update-golangci-lint-v2.6.2-migration branch December 1, 2025 21:40
@prestonvasquez
Copy link
Member Author

RE: BenchmarkBSONDeepDocumentDecoding: we are still in the stability region.

Screenshot 2025-12-01 at 2 51 48 PM

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.

2 participants