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