mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
util/set: make Clone a method (#10044)
Updates #cleanup Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
This commit is contained in:
parent
5289cfce33
commit
3a9f5c02bf
@ -19,7 +19,7 @@ func SetOf[T comparable](slice []T) Set[T] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clone returns a new set cloned from the elements in s.
|
// Clone returns a new set cloned from the elements in s.
|
||||||
func Clone[T comparable](s Set[T]) Set[T] {
|
func (s Set[T]) Clone() Set[T] {
|
||||||
return maps.Clone(s)
|
return maps.Clone(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func TestClone(t *testing.T) {
|
|||||||
if s.Len() != 4 {
|
if s.Len() != 4 {
|
||||||
t.Errorf("wrong len %d; want 4", s.Len())
|
t.Errorf("wrong len %d; want 4", s.Len())
|
||||||
}
|
}
|
||||||
s2 := Clone(s)
|
s2 := s.Clone()
|
||||||
if !s.Equal(s2) {
|
if !s.Equal(s2) {
|
||||||
t.Error("clone not equal to original")
|
t.Error("clone not equal to original")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user