From 8d189245fb13d0e3c0554798b742713798707a33 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Tue, 30 Jun 2015 14:30:28 -0400 Subject: [PATCH] Make util.empty public for conversions Some downstream components want to use a StringSet in their internal objects, but leaving util.empty private means that generated conversions cannot create constructors generically for those objects. This makes Empty public until such a time as the generator supports private types. --- pkg/util/set.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/util/set.go b/pkg/util/set.go index 1b3f9d6d839..084593f06ba 100644 --- a/pkg/util/set.go +++ b/pkg/util/set.go @@ -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{} } }