Skip to content

Commit af6421d

Browse files
committed
Make Playground compatible with GopherJS 1.18.x
1 parent 81278eb commit af6421d

File tree

2 files changed

+100
-89
lines changed

2 files changed

+100
-89
lines changed

playground/playground.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,19 @@ func main() {
174174
}
175175

176176
data := js.Global.Get("Uint8Array").New(req.Response).Interface().([]byte)
177-
packages[path], err = compiler.ReadArchive(path+".a", path, bytes.NewReader(data), importContext.Packages)
177+
packages[path], err = compiler.ReadArchive(path+".a", bytes.NewReader(data))
178178
if err != nil {
179179
scope.Apply(func() {
180180
scope.Set("output", []Line{Line{"type": "err", "content": err.Error()}})
181181
})
182182
return
183183
}
184+
if err := packages[path].RegisterTypes(importContext.Packages); err != nil {
185+
scope.Apply(func() {
186+
scope.Set("output", []Line{Line{"type": "err", "content": err.Error()}})
187+
})
188+
return
189+
}
184190
pkgsReceived++
185191
if pkgsReceived == len(pkgsToLoad) {
186192
run(loadOnly)

0 commit comments

Comments
 (0)