diff --git a/Makefile b/Makefile index 8e442aab..0571307a 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +# dummy comment .PHONY: verify verify: verify-fmt verify-lint verify-apidiff vet test diff --git a/set/ordered.go b/set/ordered.go index 2b2c11fc..36c17780 100644 --- a/set/ordered.go +++ b/set/ordered.go @@ -20,7 +20,7 @@ package set // that supports the operators < <= >= >. // If future releases of Go add new ordered types, // this constraint will be modified to include them. -type ordered interface { +type orderedBrokenAPI interface { integer | float | ~string } diff --git a/set/set.go b/set/set.go index 172482cd..3cfe59b7 100644 --- a/set/set.go +++ b/set/set.go @@ -25,17 +25,17 @@ import ( type Empty struct{} // Set is a set of the same type elements, implemented via map[ordered]struct{} for minimal memory consumption. -type Set[E ordered] map[E]Empty +type Set[E orderedBrokenAPI] map[E]Empty // New creates a new set. -func New[E ordered](items ...E) Set[E] { +func New[E orderedBrokenAPI](items ...E) Set[E] { ss := Set[E]{} ss.Insert(items...) return ss } // KeySet creates a Set[E] from a keys of a map[E](? extends interface{}). -func KeySet[E ordered, A any](theMap map[E]A) Set[E] { +func KeySet[E orderedBrokenAPI, A any](theMap map[E]A) Set[E] { ret := Set[E]{} for key := range theMap { ret.Insert(key) @@ -158,7 +158,7 @@ func (s Set[E]) Equal(s2 Set[E]) bool { return s.Len() == s.Len() && s.IsSuperset(s2) } -type sortableSlice[E ordered] []E +type sortableSlice[E orderedBrokenAPI] []E func (s sortableSlice[E]) Len() int { return len(s) @@ -168,7 +168,7 @@ func (s sortableSlice[E]) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // SortedList returns the contents as a sorted slice. func (s Set[E]) SortedList() []E { - res := make(sortableSlice[E], 0, s.Len()) + res = make(sortableSlice[E], 0, s.Len()) for key := range s { res = append(res, key) } diff --git a/set/set_test.go b/set/set_test.go index ea2d9d50..424ad9a4 100644 --- a/set/set_test.go +++ b/set/set_test.go @@ -359,7 +359,7 @@ func TestSetClearInSeparateFunction(t *testing.T) { } } -func clearSetAndAdd[T ordered](s Set[T], a T) { +func clearSetAndAdd[T orderedBrokenAPI](s Set[T], a T) { s.Clear() s.Insert(a) }