v0.0.227 error on duplicate exerr.ErrorType
This commit is contained in:
@@ -7,6 +7,9 @@ type SyncSet[TData comparable] struct {
|
||||
lock sync.Mutex
|
||||
}
|
||||
|
||||
// Add adds `value` to the set
|
||||
// returns true if the value was actually inserted
|
||||
// returns false if the value already existed
|
||||
func (s *SyncSet[TData]) Add(value TData) bool {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
@@ -15,10 +18,10 @@ func (s *SyncSet[TData]) Add(value TData) bool {
|
||||
s.data = make(map[TData]bool)
|
||||
}
|
||||
|
||||
_, ok := s.data[value]
|
||||
_, existsInPreState := s.data[value]
|
||||
s.data[value] = true
|
||||
|
||||
return !ok
|
||||
return !existsInPreState
|
||||
}
|
||||
|
||||
func (s *SyncSet[TData]) AddAll(values []TData) {
|
||||
|
Reference in New Issue
Block a user