mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
29 lines
387 B
Go
29 lines
387 B
Go
package internal
|
|
|
|
type Set map[string]struct{}
|
|
|
|
func NewStringSet() Set {
|
|
return make(Set)
|
|
}
|
|
|
|
func NewStringSetFromSlice(start []string) Set {
|
|
ret := make(Set)
|
|
for _, s := range start {
|
|
ret.Add(s)
|
|
}
|
|
return ret
|
|
}
|
|
|
|
func (s Set) Add(i string) {
|
|
s[i] = struct{}{}
|
|
}
|
|
|
|
func (s Set) Remove(i string) {
|
|
delete(s, i)
|
|
}
|
|
|
|
func (s Set) Contains(i string) bool {
|
|
_, ok := s[i]
|
|
return ok
|
|
}
|