1 096
New package with a generic set type has been accepted :)
https://github.com/golang/go/issues/69230
package set // import "golang.org/x/exp/collection/set"
Package set defines Set, an experimental prototype for what may become the
canonical representation of a set recommended for use in public APIs.
A Set[E] is transparently represented as a map[E]struct{}, and so it may be used
as the operand of a range loop.
Example:
var x, y, z set.Set[int]
x = set.Of(1, 2, 3) // "{1, 2, 3}"
y = set.Of(3, 4, 5) // "{3, 4, 5"}
z = x.Intersection(y) // "{3}"
for elem := range z {
println(elem) // "3"
}
// more examples https://github.com/golang/go/issues/69230#issuecomment-604090337506 11月, 04:58
