Merged
Conversation
966d04d to
9b388e7
Compare
- Easily verifiable - Easier to maintain
9b388e7 to
877b4b9
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the custom singleflight implementation with a generic, type‑safe wrapper around the upstream golang.org/x/sync/singleflight package for easier maintenance and verifiability.
- Introduces a wrapper that supports generics with type constraint K ~string.
- Updates go.mod and CI configurations to require Go 1.23 and newer versions of dependencies.
- Removes legacy internal implementation and redundant examples in favor of consolidated usage examples.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| singleflight.go | Replaces custom logic with a generic wrapper and adapts the API. |
| go.mod | Updates Go version to 1.23.0 and adds required dependency. |
| examples_test.go | Provides consolidated usage examples. |
| examples/Forget, examples/DoChan, examples/Do | Remove redundant examples. |
| README.md | Updates documentation to reflect the new wrapper design. |
| .github/workflows/ci.yaml | Updates CI workflow for Go 1.24.x/1.23.x and related settings. |
Comments suppressed due to low confidence (1)
singleflight.go:44
- The conversion of key to string (using string(key)) relies on the new type constraint (K ~string). Please ensure this design decision is clearly documented so that users understand that only string-like types are accepted.
result, err, shared := g.group.Do(string(key), func() (any, error) {
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.
Important
The upstream lib now requires Go 1.23.