Skip to content

proposal: x/sync/singleflight: add generic version #53427

Description

@bradfitz

The singleflight package's Group type uses string keys and interface{} 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] or singleflight.GenericGroup[K, V] or singleflight.GroupOf[K, V] behind a go1.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?)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions