set/set.go
func (s *Set) Iterator() Iterator {
	s.RLock()
	defer s.RUnlock()
	iterChan := make(chan interface{}, len(s.m))
	for k := range s.m {
		iterChan <- k
	}
	close(iterChan)
	return IterFunc(func() (interface{}, bool) {
		value, ok := <-iterChan
		return value, ok
	})
}
func (s *Set) Iterator() Iterator {
	s.RLock()
	defer s.RUnlock()
	iterChan := make(chan interface{}, len(s.m))
	for k := range s.m {
		iterChan <- k
	}
	close(iterChan)
	return IterFunc(func() (interface{}, bool) {
		value, ok := <-iterChan
		return value, ok
	})
}
// Iterator returns a new Iterator to iterate through values in the set.
// Each call to this method creates a new Iterator. Therefore, the
// returned Iterator should be assigned to a variable before usage.
//
// It is safe to create and use multiple Iterators in multiple goroutines.