mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 21:21:14 +00:00
Add a NewStringSet() function
Also beef up tests to cover len(ss).
This commit is contained in:
@@ -21,6 +21,13 @@ type empty struct{}
|
||||
// A set of strings, implemented via map[string]struct{} for minimal memory consumption.
|
||||
type StringSet map[string]empty
|
||||
|
||||
// NewStringSet creates a StringSet from a list of values.
|
||||
func NewStringSet(items ...string) StringSet {
|
||||
ss := StringSet{}
|
||||
ss.Insert(items...)
|
||||
return ss
|
||||
}
|
||||
|
||||
// Insert adds items to the set.
|
||||
func (s StringSet) Insert(items ...string) {
|
||||
for _, item := range items {
|
||||
|
Reference in New Issue
Block a user