Skip to content

Commit cfcb38d

Browse files
committed
playground: Fix build error.
Needed after compiler.NewImportContext was removed in gopherjs/gopherjs@76dd0e0.
1 parent 27f2358 commit cfcb38d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

playground/playground.go

+11-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"go/parser"
88
"go/scanner"
99
"go/token"
10+
"go/types"
1011
"strings"
1112
"time"
1213

@@ -62,13 +63,16 @@ func main() {
6263

6364
packages := make(map[string]*compiler.Archive)
6465
var pkgsToLoad map[string]struct{}
65-
importContext := compiler.NewImportContext(func(path string) (*compiler.Archive, error) {
66-
if pkg, found := packages[path]; found {
67-
return pkg, nil
68-
}
69-
pkgsToLoad[path] = struct{}{}
70-
return &compiler.Archive{}, nil
71-
})
66+
importContext := &compiler.ImportContext{
67+
Packages: map[string]*types.Package{"unsafe": types.Unsafe},
68+
Import: func(path string) (*compiler.Archive, error) {
69+
if pkg, found := packages[path]; found {
70+
return pkg, nil
71+
}
72+
pkgsToLoad[path] = struct{}{}
73+
return &compiler.Archive{}, nil
74+
},
75+
}
7276
fileSet := token.NewFileSet()
7377
pkgsReceived := 0
7478

0 commit comments

Comments
 (0)