GODRIVER-4044 Update golang.org/x/text to v0.39.0 and raise minimum Go version to 1.25. by qingyang-hu · Pull Request #2522 · mongodb/mongo-go-driver · GitHub
Skip to content

GODRIVER-4044 Update golang.org/x/text to v0.39.0 and raise minimum Go version to 1.25. - #2522

Merged
prestonvasquez merged 5 commits into
mongodb:masterfrom
qingyang-hu:godriver4044cve
Aug 12, 2026
Merged

prestonvasquez merged 5 commits into
mongodb:masterfrom
qingyang-hu:godriver4044cve

Conversation

@qingyang-hu

@qingyang-hu qingyang-hu commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

GODRIVER-4044

Summary

  • Update golang.org/x/text to v0.39.0.
  • Raise the minimum Go version to 1.25.
  • Update docs to say the Go Driver supports the last 2 Go minor versions.
  • Lint and vet fixes for Go 1.25.

Notes

This PR is going to be merged into release/2.8.

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file review-priority-normal Medium Priority PR for Review: within 1 business day documentation Pull requests that update documentation or examples labels Jul 30, 2026
@mongodb-drivers-pr-bot

mongodb-drivers-pr-bot Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

@mongodb-drivers-pr-bot

Copy link
Copy Markdown
Contributor

API Change Report

No changes found!

@qingyang-hu
qingyang-hu marked this pull request as ready for review August 6, 2026 15:06
@qingyang-hu
qingyang-hu requested a review from a team as a code owner August 6, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the driver’s Go toolchain baseline to Go 1.25 and refreshes golang.org/x/text to v0.39.0 (plus related x/* bumps), along with the associated docs and small lint/vet-driven cleanups across the codebase.

Changes:

  • Raise the module Go version to 1.25 and update build/compilecheck tasks accordingly.
  • Bump golang.org/x/text to v0.39.0 (and related golang.org/x/* dependency updates across submodules/examples).
  • Apply Go 1.25 lint/vet cleanups (identifier renames avoiding min/max shadowing and small formatting/test-message tweaks).

Reviewed changes

Copilot reviewed 29 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
x/mongo/driver/topology/rtt_monitor.go Rename local min variable and gofmt-style formatting.
x/mongo/driver/operation/find.go Rename parameters for Max/Min setters to avoid max/min naming.
x/mongo/driver/operation/create.go Rename Max parameter to avoid max naming.
Taskfile.yml Switch build compilecheck from compilecheck-119 to compilecheck-125.
README.md Update requirements to Go 1.25+ and remove obsolete dep install guidance.
mongo/options/indexoptions.go Rename SetMax/SetMin parameters to avoid max/min naming.
mongo/options/findoptions.go Rename SetMax/SetMin parameters to avoid max/min naming.
mongo/options/encryptoptions.go Rename RangeOptionsBuilder min/max parameters to avoid min/max naming.
mongo/options/createcollectionoptions.go Rename SetMaxDocuments parameter to avoid max naming.
mongo/doc.go Document “last two Go minor versions” support policy.
mongo/collection.go Rename local max/min variables used during marshaling.
internal/test/goleak/go.sum Update indirect golang.org/x/* sums.
internal/test/goleak/go.mod Update indirect golang.org/x/* requirements.
internal/test/compilecheck/compile_check_test.go Update compilecheck versioning and toolchain pinning behavior for Go 1.25+.
internal/serverselector/server_selector.go Rename local min/max RTT variables for clarity and lint compatibility.
internal/rand/rand_test.go Remove custom max helper and improve error reporting call.
internal/integration/mtest/mongotest.go Rename version constraint parameters for clarity.
internal/integration/mtest/libmongocrypt_version_not_enabled.go Rename version constraint parameters for clarity.
internal/integration/mtest/libmongocrypt_version_enabled.go Rename version constraint parameters for clarity.
internal/driverutil/description.go Rename version range constructor parameters for clarity.
internal/cmd/faas/awslambda/mongodb/go.sum Update indirect golang.org/x/* sums.
internal/cmd/faas/awslambda/mongodb/go.mod Update indirect golang.org/x/* requirements.
internal/cmd/benchmark/go.sum Update indirect golang.org/x/* sums.
internal/cmd/benchmark/go.mod Update indirect golang.org/x/* requirements.
internal/assert/difflib.go Remove local min/max helpers (relying on predeclared builtins).
internal/assert/assertions.go Rename local max variable and apply gofmt-style formatting.
internal/assert/assertion_mongo.go Remove local min/max closures (relying on predeclared builtins).
internal/assert/assertion_compare_test.go Improve test error messages and formatting.
go.sum Update dependency sums (notably golang.org/x/text and golang.org/x/sync).
go.mod Raise Go version and bump golang.org/x/text / golang.org/x/sync.
examples/go.sum Update indirect golang.org/x/* sums for examples module.
examples/go.mod Update indirect golang.org/x/* requirements for examples module.
docs/CONTRIBUTING.md Update contribution docs for Go 1.25+ and “last two minors” support policy.
AGENTS.md Update agent guidance to reflect Go 1.25 minimum and compilecheck target rename.
Suppressed comments (1)

internal/assert/assertion_compare_test.go:83

  • Grammar: this error message should use singular verb agreement (or match the earlier "should be comparable" phrasing).
			t.Errorf("object are comparable for type %s", currCase.cType)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +41 to 45
// go test -v -run '^TestCompileCheck/go:1.25$'
// go test -v -run '^TestCompileCheck/go:1\.(25|26)$'
var goVersions = []string{
"1.19", // Minimum supported Go version for mongo-driver v2
"1.20",
"1.21",
"1.22",
"1.23",
"1.24",
"1.25", // Test suite Go Version
"1.25", // Minimum supported Go version for mongo-driver v2
}
resGreater, isComparable := compare(currCase.greater, currCase.less, reflect.ValueOf(currCase.less).Kind())
if !isComparable {
t.Error("object are comparable for type " + currCase.cType)
t.Errorf("object are comparable for type %s", currCase.cType)
@prestonvasquez

Copy link
Copy Markdown
Member

@qingyang-hu We shouldn't bump to Go 1.25.0 on a patch version, this is a build break for any user on 1.19-1.24. This should be released in the next minor version.

@qingyang-hu

Copy link
Copy Markdown
Contributor Author

We won't be able to patch v2.8.x if we choose not to bump the Go version.

@prestonvasquez

Copy link
Copy Markdown
Member

We won't be able to patch v2.8.x if we choose not to bump the Go version.

I think that's fine. We aren't back-porting to any of the other 2.x release branches, either. We only support latest minor and dev branch.

We should also update this to include an "important" section noting the bump: https://jira.mongodb.org/browse/GODRIVER-4067

@prestonvasquez

Copy link
Copy Markdown
Member

[blocking] This needs to be updated:

go test -v ./internal/test/compilecheck -run '^TestCompileCheck/go:1\.19$'

codeql should be erroring but doesn't since 1.19 isn't actually matching a test. I've opened GODRIVER-4077 to resolve this in the future. For now I think it's fine since the Taskfile covers it.

"1.23",
"1.24",
"1.25", // Test suite Go Version
"1.25", // Minimum supported Go version for mongo-driver v2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blocker] This list should include 1.26: https://jira.mongodb.org/browse/GODRIVER-3882

Comment on lines +168 to +171
toolchainVer := ver
if ver == testSuiteVersion {
toolchainVer = ""
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blocking] This would subvert the expectation of the test. We are explicitly telling it to use 1.X.0 but then this uses 1.X.Y. We should remove this block. If we need to optimize, suggest adding a note to Dockerfile to use images with 0 patch version.


// Set minimum Go version to what the driver claims (first version in our test list).
_ = execGo(t, container, nil, "mod", "edit", "-go="+goVersions[0])
_ = execGo(t, container, nil, "mod", "tidy")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blocking] go mod tidy has to come before go mod edit -go=goVersion[0], otherwise the latter is a no-op. tidy will raise the go directive back to whatever the drivers go.mod requires. IIUC the only reason this works is because the mod file matches the only version we are testing. This will break when new versions are added to goVersions.

Comment thread Taskfile.yml Outdated
- task: compilecheck-125
build-tests: go test -short ${BUILD_TAGS} -run ^$$ ./...
compilecheck-119:
compilecheck-125:

@prestonvasquez prestonvasquez Aug 10, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] Rename this to compilecheck-min to minimize the work required for a future bump

Comment thread Taskfile.yml
cmds:
- go mod download
- GOTOOLCHAIN=auto go test -v -run '^TestCompileCheck/go:1\.19$'
- GOTOOLCHAIN=auto go test -v -run '^TestCompileCheck/go:1\.25$'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blocking] This should use COMPILE_CHECK_MIN_ONLY instead of passing 1.25 directly as regex.

- GOTOOLCHAIN=auto COMPILE_CHECK_MIN_ONLY=1 go test -v

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] Why are these renames necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The min/max triggers the built-in shadowing lint. min/max became built-ins in Go 1.21 and were flagged by the revive linter.

Non-constant format strings are flagged by go vet.

@qingyang-hu
qingyang-hu changed the base branch from release/2.8 to master August 11, 2026 14:06
@prestonvasquez
prestonvasquez merged commit d20c5db into mongodb:master Aug 12, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Pull requests that update documentation or examples review-priority-normal Medium Priority PR for Review: within 1 business day

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants