Merge pull request #10561 from smarterclayton/make_empty_public

Make util.empty public for conversions
This commit is contained in:
Wojciech Tyczynski 2015-07-02 09:31:25 +02:00
commit 2f4574167d

View File

@ -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{}
}
}