From cfcb38dff3c2c6ec17ee4071ce28f7a38ed709e3 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sat, 20 Feb 2016 17:22:16 -0800 Subject: [PATCH 1/2] playground: Fix build error. Needed after compiler.NewImportContext was removed in https://github.com/gopherjs/gopherjs/commit/76dd0e02d28e5192523ef1ee98becbd86c918cff. --- playground/playground.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/playground/playground.go b/playground/playground.go index 5f30f67b..616dc870 100644 --- a/playground/playground.go +++ b/playground/playground.go @@ -7,6 +7,7 @@ import ( "go/parser" "go/scanner" "go/token" + "go/types" "strings" "time" @@ -62,13 +63,16 @@ func main() { packages := make(map[string]*compiler.Archive) var pkgsToLoad map[string]struct{} - importContext := compiler.NewImportContext(func(path string) (*compiler.Archive, error) { - if pkg, found := packages[path]; found { - return pkg, nil - } - pkgsToLoad[path] = struct{}{} - return &compiler.Archive{}, nil - }) + importContext := &compiler.ImportContext{ + Packages: map[string]*types.Package{"unsafe": types.Unsafe}, + Import: func(path string) (*compiler.Archive, error) { + if pkg, found := packages[path]; found { + return pkg, nil + } + pkgsToLoad[path] = struct{}{} + return &compiler.Archive{}, nil + }, + } fileSet := token.NewFileSet() pkgsReceived := 0 From 2068927b0f33353a15c62a868758855232334673 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sat, 20 Feb 2016 18:21:30 -0800 Subject: [PATCH 2/2] playground: Don't include unsafe in packages. No longer needed as of https://github.com/gopherjs/gopherjs/commit/f8510c9aef19750ec5a1178b33932a7f9defd197. --- playground/playground.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/playground.go b/playground/playground.go index 616dc870..7a585d3e 100644 --- a/playground/playground.go +++ b/playground/playground.go @@ -64,7 +64,7 @@ func main() { packages := make(map[string]*compiler.Archive) var pkgsToLoad map[string]struct{} importContext := &compiler.ImportContext{ - Packages: map[string]*types.Package{"unsafe": types.Unsafe}, + Packages: make(map[string]*types.Package), Import: func(path string) (*compiler.Archive, error) { if pkg, found := packages[path]; found { return pkg, nil