danieljoos / go-wasm-examples

Some small examples of using Go and WebAssembly
38 stars 8 forks source link

Examples 2, 3, 4 don't build on 1.12.6 #2

Closed 200sc closed 5 years ago

200sc commented 5 years ago

When I try to run wasm1, everything goes fine, but running 2 3 or 4 results in something like this in the console window.

panic: syscall/js: Value.Call: property _makeFuncWrapper is not a function, got undefined wasm_exec.js:41:14
wasm_exec.js:41:14
goroutine 1 [running]: wasm_exec.js:41:14
syscall/js.Value.Call(0x7ff8000000000007, 0x93258, 0x10, 0xc06b7e0, 0x1, 0x1, 0x20) wasm_exec.js:41:14
    c:/go/src/syscall/js/js.go:299 +0x87 wasm_exec.js:41:14
syscall/js.FuncOf(0xc00a2a0, 0xc00a2a0, 0xc02e2a0) wasm_exec.js:41:14
    c:/go/src/syscall/js/func.go:46 +0xa wasm_exec.js:41:14
net/http.(*Transport).RoundTrip(0x3a8180, 0xc0a4000, 0x0, 0x0, 0x0) wasm_exec.js:41:14
    c:/go/src/net/http/roundtrip_js.go:96 +0x56 wasm_exec.js:41:14
net/http.send(0xc0a4000, 0xe1a60, 0x3a8180, 0x0, 0x0, 0x0, 0x0, 0xc00c050, 0xc028ae0, 0x1) wasm_exec.js:41:14
    c:/go/src/net/http/client.go:250 +0x5d wasm_exec.js:41:14
net/http.(*Client).send(0x3b4520, 0xc0a4000, 0x0, 0x0, 0x0, 0xc00c050, 0x0, 0x1, 0x3b4f40) wasm_exec.js:41:14
    c:/go/src/net/http/client.go:174 +0x15 wasm_exec.js:41:14
net/http.(*Client).do(0x3b4520, 0xc0a4000, 0x0, 0x0, 0x0) wasm_exec.js:41:14
    c:/go/src/net/http/client.go:641 +0x17 wasm_exec.js:41:14
net/http.(*Client).Do(...) wasm_exec.js:41:14
    c:/go/src/net/http/client.go:509 wasm_exec.js:41:14
net/http.(*Client).Get(0x3b4520, 0xc06e050, 0x42, 0x91b64, 0xa, 0x939a6) wasm_exec.js:41:14
    c:/go/src/net/http/client.go:398 +0x7 wasm_exec.js:41:14
net/http.Get(...) wasm_exec.js:41:14
    c:/go/src/net/http/client.go:370 wasm_exec.js:41:14
github.com/PaulRosset/go-hacknews.Initializer.GetCodesStory(0x91b64, 0xa, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0) wasm_exec.js:41:14
    D:/work/plasticPiston/src/github.com/PaulRosset/go-hacknews/hacknews_api.go:38 +0x5 wasm_exec.js:41:14
main.topStories(0x106e0039, 0xc030058, 0x0) wasm_exec.js:41:14
    D:/work/plasticPiston/src/github.com/danieljoos/go-wasm-examples/wasm3/main.go:15 +0x2 wasm_exec.js:41:14
main.main() wasm_exec.js:41:14
    D:/work/plasticPiston/src/github.com/danieljoos/go-wasm-examples/wasm3/main.go:51 +0x2 wasm_exec.js:41:14
exit code: 2 wasm_exec.js:106:14

I tested on Windows 10, on Firefox and Chrome.

200sc commented 5 years ago

Based on this: https://stackoverflow.com/questions/57154587/panic-syscall-js-value-call-property-makefuncwrapper-is-not-a-function-got

The server might have downloaded a newer wasm_exec.js than the one for 1.12

200sc commented 5 years ago

So yes, I replaced the locally downloaded wasm_exec.js with the one I found in my goroot and the examples started working.

danieljoos commented 5 years ago

Good catch. I narrowed it down to the changes made here: https://github.com/golang/go/commit/c468ad04177c422534ad1ed4547295935f84743d#diff-956ed5abd94e3f82adfe493f134403b5 Will investigate further what is causing the issue.