Skip to content

Commit

Permalink
Represent set as map[string]bool instead of map[string]struct{}.
Browse files Browse the repository at this point in the history
  • Loading branch information
emidoots committed Aug 17, 2014
1 parent 812d8a4 commit 0c88c0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ func generate(name string, args []string) {
}

// Converts a slice string into a simple lookup map.
func lookupMap(s []string) map[string]struct{} {
lookup := make(map[string]struct{}, len(s))
func lookupMap(s []string) map[string]bool {
lookup := make(map[string]bool, len(s))
for _, str := range s {
lookup[str] = struct{}{}
lookup[str] = true
}
return lookup
}
Expand Down
2 changes: 1 addition & 1 deletion package.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (pkg *Package) HasRequiredFunctions() bool {
// Filter removes any enums, or functions found in this package that are not
// listed in the given lookup maps. If either of the maps has a length of zero,
// filtering does not occur for that type (e.g. all functions are left intact).
func (pkg *Package) Filter(enums, functions map[string]struct{}) {
func (pkg *Package) Filter(enums, functions map[string]bool) {
if len(enums) > 0 {
// Remove any enum not listed in the enums lookup map.
for name := range pkg.Enums {
Expand Down

0 comments on commit 0c88c0b

Please sign in to comment.