mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Merge pull request #10561 from smarterclayton/make_empty_public
Make util.empty public for conversions
This commit is contained in:
commit
2f4574167d
@ -21,10 +21,12 @@ import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
type empty struct{}
|
||||
// Empty is public since it is used by some internal API objects for conversions between external
|
||||
// string arrays and internal sets, and conversion logic requires public types today.
|
||||
type Empty struct{}
|
||||
|
||||
// StringSet is a set of strings, implemented via map[string]struct{} for minimal memory consumption.
|
||||
type StringSet map[string]empty
|
||||
type StringSet map[string]Empty
|
||||
|
||||
// NewStringSet creates a StringSet from a list of values.
|
||||
func NewStringSet(items ...string) StringSet {
|
||||
@ -48,7 +50,7 @@ func KeySet(theMap reflect.Value) StringSet {
|
||||
// Insert adds items to the set.
|
||||
func (s StringSet) Insert(items ...string) {
|
||||
for _, item := range items {
|
||||
s[item] = empty{}
|
||||
s[item] = Empty{}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user