Optimize: Use maps.Keys, slices.Collect and slices.Contains instead of custom functions#3758
Merged
Merged
Conversation
…slices.Contains) instead of custom functions
Contributor
Author
|
My apologies, these changes should have been included in PR #3746 , but I missed them. |
ndyakov
approved these changes
Mar 30, 2026
romanpovol
pushed a commit
to romanpovol/go-redis
that referenced
this pull request
Apr 8, 2026
…instead of custom functions (redis#3758) * Optimize: Use modern Go standard library (maps.Keys, slices.Collect, slices.Contains) instead of custom functions * format
ndyakov
added a commit
that referenced
this pull request
Apr 9, 2026
* feat(vectorset): WIP * feat(vectorsets): WITHATTRIBS & VIsMember * fix(vectorsets): fix tests * fix(vectorsets): improve doctest/ * feat(vectorsets): add test with nil attrs * fix(vectorsets): typo Epsilon * fix: review issues * chore(go): use -compat=1.24 (#3754) Signed-off-by: Xiaolong Chen <fukua95@gmail.com> * chore(maps): Use `maps.Keys`, `slices.Collect` and `slices.Contains` instead of custom functions (#3758) * Optimize: Use modern Go standard library (maps.Keys, slices.Collect, slices.Contains) instead of custom functions * format * chore(deps): bump codecov/codecov-action from 5 to 6 (#3757) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5 to 6. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v5...v6) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(ring): inline rendezvous hashing and remove external dependency (#3762) * ring: remove external rendezvous dependency by inlining implementation Replace usage of github.com/dgryski/go-rendezvous with an internal implementation to eliminate the external dependency and avoid licence propagation concerns. The implementation preserves the exact hashing algorithm and behaviour: - same hash combination: khash ^ nhash - same mixing function (xorshift* variant) - same node ordering semantics No functional changes intended. * Refactor TestRendezvous to remove randomString function Replaced function with inline string generation for test cases. * test: refactor RendezvousHash tests to use Ginkgo and Gomega * test: improve RendezvousHash test for per-instance determinism and distribution balance * test: enhance distribution verification in RendezvousHash tests --------- Signed-off-by: Xiaolong Chen <fukua95@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: cxljs <fukua95@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bigsk <i@ianxia.com> Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
Mostly mechanical refactors, but it changes core
PubSub/Sentinel code paths and relies on newer stdlib helpers (maps.Keys+slices.Collect/slices.Contains), which could break builds if the project’s Go version isn’t aligned.Overview
Removes custom slice/map helper functions and replaces them with standard library utilities.
In
pubsub.go, channel/pattern key collection forPubSub.String(), connection setup, and resubscription now usesslices.Collect(maps.Keys(...))instead of a localmapKeyshelper. Insentinel.go, sentinel address deduplication switches from a localcontainshelper toslices.Contains.Doctest examples in
doctests/timeseries_tut_test.gosimilarly migrate map key collection toslices.Collect(maps.Keys(...))and drop the tutorial-localmapKeysimplementation.Written by Cursor Bugbot for commit e4476dc. This will update automatically on new commits. Configure here.