Skip to content

Commit bd4e19c

Browse files
committed
use map[string]struct{} for pkgsToLoad set
1 parent ee7de23 commit bd4e19c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

playground/playground.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ func main() {
5959
scope.Set("showShareUrl", false)
6060

6161
packages := make(map[string]*compiler.Archive)
62-
var pkgsToLoad map[string]bool
62+
var pkgsToLoad map[string]struct{}
6363
importContext := compiler.NewImportContext(func(path string) (*compiler.Archive, error) {
6464
if pkg, found := packages[path]; found {
6565
return pkg, nil
6666
}
67-
pkgsToLoad[path] = true
67+
pkgsToLoad[path] = struct{}{}
6868
return &compiler.Archive{}, nil
6969
})
7070
fileSet := token.NewFileSet()
@@ -116,7 +116,7 @@ func main() {
116116
run = func(loadOnly bool) {
117117
output = nil
118118
scope.Set("output", output)
119-
pkgsToLoad = make(map[string]bool)
119+
pkgsToLoad = make(map[string]struct{})
120120

121121
file, err := parser.ParseFile(fileSet, "prog.go", []byte(scope.Get("code").String()), parser.ParseComments)
122122
if err != nil {

0 commit comments

Comments
 (0)