Repository navigation
GODRIVER-4044 Update golang.org/x/text to v0.39.0 and raise minimum Go version to 1.25. - #2522
Conversation
API Change ReportNo changes found! |
22a8820 to
a13798a
Compare
There was a problem hiding this comment.
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/textto v0.39.0 (and relatedgolang.org/x/*dependency updates across submodules/examples). - Apply Go 1.25 lint/vet cleanups (identifier renames avoiding
min/maxshadowing 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.
| // 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) |
|
@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. |
|
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 |
|
[blocking] This needs to be updated: 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 |
There was a problem hiding this comment.
[blocker] This list should include 1.26: https://jira.mongodb.org/browse/GODRIVER-3882
| toolchainVer := ver | ||
| if ver == testSuiteVersion { | ||
| toolchainVer = "" | ||
| } |
There was a problem hiding this comment.
[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") |
There was a problem hiding this comment.
[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.
| - task: compilecheck-125 | ||
| build-tests: go test -short ${BUILD_TAGS} -run ^$$ ./... | ||
| compilecheck-119: | ||
| compilecheck-125: |
There was a problem hiding this comment.
[suggestion] Rename this to compilecheck-min to minimize the work required for a future bump
| cmds: | ||
| - go mod download | ||
| - GOTOOLCHAIN=auto go test -v -run '^TestCompileCheck/go:1\.19$' | ||
| - GOTOOLCHAIN=auto go test -v -run '^TestCompileCheck/go:1\.25$' |
There was a problem hiding this comment.
[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
There was a problem hiding this comment.
[question] Why are these renames necessary?
There was a problem hiding this comment.
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.
31009d8 to
071f5a9
Compare
071f5a9 to
4b056d9
Compare

GODRIVER-4044
Summary
Notes
This PR is going to be merged into release/2.8.