Skip to content

Commit 0c88c0b

Browse files
author
Stephen Gutekanst
committed
Represent set as map[string]bool instead of map[string]struct{}.
1 parent 812d8a4 commit 0c88c0b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ func generate(name string, args []string) {
115115
}
116116

117117
// Converts a slice string into a simple lookup map.
118-
func lookupMap(s []string) map[string]struct{} {
119-
lookup := make(map[string]struct{}, len(s))
118+
func lookupMap(s []string) map[string]bool {
119+
lookup := make(map[string]bool, len(s))
120120
for _, str := range s {
121-
lookup[str] = struct{}{}
121+
lookup[str] = true
122122
}
123123
return lookup
124124
}

package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (pkg *Package) HasRequiredFunctions() bool {
112112
// Filter removes any enums, or functions found in this package that are not
113113
// listed in the given lookup maps. If either of the maps has a length of zero,
114114
// filtering does not occur for that type (e.g. all functions are left intact).
115-
func (pkg *Package) Filter(enums, functions map[string]struct{}) {
115+
func (pkg *Package) Filter(enums, functions map[string]bool) {
116116
if len(enums) > 0 {
117117
// Remove any enum not listed in the enums lookup map.
118118
for name := range pkg.Enums {

0 commit comments

Comments
 (0)