strset
strset copied to clipboard
Immutable set type / frozenset
The advice to delete updaters.go probably wouldn't work well in practice. Removing a file is not a common practice and has no support in tooling such as dep and similars.
How about creating a new type exposed through the API? It might be named ImmutableSet, FrozenSet, or something like that, with these methods:
func MakeImmutable(elems ...string) ImmutableSet
func MakeImmutableFromText(text string) ImmutableSet
func (s ImmutableSet) Channel() <-chan string
func (s ImmutableSet) Contains(elem string) bool
func (s ImmutableSet) ContainsAll(elems ...string) bool
func (s ImmutableSet) Copy() ImmutableSet
func (s ImmutableSet) Difference(other ImmutableSet) ImmutableSet
func (s ImmutableSet) Equal(other ImmutableSet) bool
func (s ImmutableSet) Intersection(other ImmutableSet) ImmutableSet
func (s ImmutableSet) Len() int
func (s ImmutableSet) String() string
func (s ImmutableSet) SubImmutableSetOf(other ImmutableSet) bool
func (s ImmutableSet) SuperImmutableSetOf(other ImmutableSet) bool
func (s ImmutableSet) SymmetricDifference(other ImmutableSet) ImmutableSet
func (s ImmutableSet) ToSlice() []string
func (s ImmutableSet) Union(other ImmutableSet) ImmutableSet