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
proposal: x/sync/singleflight: add generic version #53427
Comments
Forked from golang.org/x/sync/singleflight at the x/sync repo's commit 67f06af15bc961c363a7260195bcd53487529a21 Updates golang/go#53427 Change-Id: Iec2b47b7777940017bb9b3db9bd7d93ba4a2e394 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Forked from golang.org/x/sync/singleflight at the x/sync repo's commit 67f06af15bc961c363a7260195bcd53487529a21 Updates golang/go#53427 Change-Id: Iec2b47b7777940017bb9b3db9bd7d93ba4a2e394 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Forked from golang.org/x/sync/singleflight at the x/sync repo's commit 67f06af15bc961c363a7260195bcd53487529a21 Updates golang/go#53427 Change-Id: Iec2b47b7777940017bb9b3db9bd7d93ba4a2e394 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Forked from golang.org/x/sync/singleflight at the x/sync repo's commit 67f06af15bc961c363a7260195bcd53487529a21 Updates golang/go#53427 Change-Id: Iec2b47b7777940017bb9b3db9bd7d93ba4a2e394 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
I don't think we have a convention yet. |
What about x/sync/v2/singleflight ? |
Forked from golang.org/x/sync/singleflight at the x/sync repo's commit 67f06af15bc961c363a7260195bcd53487529a21 Updates golang/go#53427 Change-Id: Iec2b47b7777940017bb9b3db9bd7d93ba4a2e394 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
I tried it before. Thank you. refs: #52520 |
Change https://go.dev/cl/425187 mentions this issue: |
Is there any update on this proposal? |
@lmittmann No. |
This proposal has been added to the active column of the proposals project |
Maybe it should be |
This really circles back to #48287, which we didn't resolve. |
I know this might sound crazy, but how about simply introducing a breaking change in an experimental package, which is v0, and has "looser compatibility requirements"? |
I agree that in this case and more generally in x/* experimental packages the right thing to do is a breaking change, eitherwise the whole purpose of these packages is mute and might as well put them directly under the standard library. |
Holding for #48287. |
Placed on hold. |
I took a crack at the v2 formulation for this change. I've posted it as a draft because it differs enough from the original proposal that I didn't want to send it out for full review unless I heard from @bradfitz or @rsc that this was an okay way to use the original. Happy to instead create a new proposal ticket for the v2 version of this if those folks would prefer! |
The singleflight package's
Group
type usesstring
keys andinterface{}
values:https://pkg.go.dev/golang.org/x/sync/singleflight#Group
I've locally forked it to add generics
[K comparable, V any]
but I'd like to get it upstream instead.Proposal: add
singleflight.TypedGroup[K, V]
orsingleflight.GenericGroup[K, V]
orsingleflight.GroupOf[K, V]
behind ago1.18
build tag.Do we have a convention yet on naming new parallel generic types alongside others?
Related: #47657 (for PoolOf, MapOf). (There was also talk of default type parameters so old code could instantiate types and get the old behavior (in this case
[string, any]
) and new callers could specify types?)The text was updated successfully, but these errors were encountered: