-
Notifications
You must be signed in to change notification settings - Fork 2.5k
chore(go): update go version to 1.21 #3640
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
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 updates the minimum required Go version from 1.18 to 1.21 across the entire codebase, including all modules, examples, and build scripts. The update includes adding Go 1.21 to the CI test matrix and implementing Go 1.21-compatible alternatives for features that were only added in Go 1.23+.
- Updated
go.modfiles across main module, examples, and extras to require Go 1.21 - Added Go 1.21.x to CI workflow test matrix to ensure compatibility with the minimum supported version
- Implemented Go 1.21-compatible atomic operations (AND/OR) using CompareAndSwap loops instead of Go 1.23's atomic And/Or methods
- Replaced
slices.Collect(maps.Keys())with a custom helper function for Go 1.21 compatibility
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Updated minimum Go version from 1.18 to 1.21 for main module |
| go.sum | Updated dependency hashes with additional mod file entries |
| internal/customvet/go.mod | Updated Go version from 1.17 to 1.21 |
| internal/routing/aggregator.go | Replaced Go 1.23 atomic And/Or methods with CAS-based implementations for Go 1.21 compatibility |
| doctests/timeseries_tut_test.go | Removed maps/slices imports and added custom mapKeys helper function compatible with Go 1.21 |
| scripts/release.sh | Updated go mod tidy compat flag from 1.18 to 1.21 |
| README.md | Updated documentation to reflect Go 1.21 as minimum version and added 1.21 to tested versions |
| .github/workflows/build.yml | Added Go 1.21.x to CI test matrix for both benchmark and test jobs |
| extra/redisprometheus/go.mod | Updated Go version from 1.19 to 1.21 |
| extra/redisotel/go.mod | Updated Go version from 1.19 to 1.21 |
| extra/rediscmd/go.mod | Updated Go version from 1.19 to 1.21 |
| extra/rediscensus/go.mod | Updated Go version from 1.19 to 1.21 |
| example/scan-struct/go.mod | Updated Go version from 1.18 to 1.21 |
| example/redis-bloom/go.mod | Updated Go version from 1.18 to 1.21 |
| example/maintnotifiations-pubsub/go.mod | Updated Go version from 1.18 to 1.21 |
| example/lua-scripting/go.mod | Updated Go version from 1.18 to 1.21 |
| example/hset-struct/go.mod | Updated Go version from 1.18 to 1.21 |
| example/hll/go.mod | Updated Go version from 1.18 to 1.21 |
| example/digest-optimistic-locking/go.mod | Updated Go version from 1.18 to 1.21 |
| example/del-keys-without-ttl/go.mod | Updated Go version from 1.18 to 1.21 |
| example/cluster-mget/go.mod | Updated Go version from 1.18 to 1.21 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
bobymicroby
left a comment
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.
LgTm
Thanks to the work done by @ccoVeille it was determined that we use features not available in go
1.18and we decided to gradually move towards1.23. Initially we will move to1.21and with the release of1.26we will bump to1.23. After that, with each new golang version we will jump one version, which means that at the end, our minimal go version will be three versions before the latest release - just a reminder, go officially supports the last two versions (stableandoldstable).