sets.String is deprecated: use generic Set instead. new ways: s1 := Set[string]{} s2 := New[string]() (#9589)

Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
This commit is contained in:
Fish-pro 2023-02-16 22:05:48 +08:00 committed by GitHub
parent 1cdd61fb94
commit ac8dd3dd53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 18 deletions

View file

@ -37,13 +37,13 @@ type ObjectRefMap interface {
type objectRefMap struct {
sync.Mutex
v map[string]sets.String
v map[string]sets.Set[string]
}
// NewObjectRefMap returns a new ObjectRefMap.
func NewObjectRefMap() ObjectRefMap {
return &objectRefMap{
v: make(map[string]sets.String),
v: make(map[string]sets.Set[string]),
}
}
@ -54,7 +54,7 @@ func (o *objectRefMap) Insert(consumer string, ref ...string) {
for _, r := range ref {
if _, ok := o.v[r]; !ok {
o.v[r] = sets.NewString(consumer)
o.v[r] = sets.New[string](consumer)
continue
}
o.v[r].Insert(consumer)
@ -112,7 +112,7 @@ func (o *objectRefMap) Reference(ref string) []string {
if !ok {
return make([]string, 0)
}
return consumers.List()
return consumers.UnsortedList()
}
// ReferencedBy returns all objects referenced by the given object.