deckarep / golang-set

A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp.
Other
4.15k stars 274 forks source link

Accept arbitrary type slices to NewSetFromSlice methods #72

Closed shreve closed 2 years ago

shreve commented 3 years ago

Previously, the NewSetFromSlice methods required the input slices to be typed as []interface{}. This can be cumbersome because a new slice with that type actually needs to be created, and it's elements converted to interface{} every time in the client application.

Now, the NewSetFromSlice methods accept a generic interface{} type and use reflection to convert whatever the source slice was into the requisite interface{}s.

This addresses #70

jeffwidman commented 2 years ago

Should this be closed given that its functionality is replaced by the new generics-based implementation?

deckarep commented 2 years ago

Yes agreed.