danieljoos / go-wasm-examples

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

Doesn't build using go1.12 #1

Closed davmaz closed 5 years ago

davmaz commented 5 years ago

Hi - Very nice examples, but they won't build under 1.12. Can you steer me in the right direction to fix this? Thanks!

danieljoos commented 5 years ago

Mhh... just tried with Go 1.12 on Windows 10 and it builds without problems. Where exactly do you get the error? Does the following compilation work for you?:

(Bash)

GOARCH=wasm GOOS=js go build -o test.wasm ./wasm1

(Windows Powershell)

$env:GOARCH="wasm"
$env:GOOS="js"
go build -o test.wasm ./wasm1
davmaz commented 5 years ago

Yes, that works for me too. But /wasm2 is where the problems start:

~/WASM/DanielJoos/wasm2

wasm2/main.go:12:28: undefined: js.NewCallback

I don't see a js.NewCallback in the js package. Am I missing something?

Best,

Dave


From: Daniel Joos notifications@github.com Sent: Tuesday, March 12, 2019 12:27:02 PM To: danieljoos/go-wasm-examples Cc: davem@ltsnet.net; Author Subject: Re: [danieljoos/go-wasm-examples] Doesn't build using go1.12 (#1)

Mhh... just tried with Go 1.12 on Windows 10 and it builds without problems. Where exactly do you get the error? Does the following compilation work for you?:

GOARCH=wasm GOOS=js go build -o test.wasm ./wasm1

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/danieljoos/go-wasm-examples/issues/1#issuecomment-472074881, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAgSBjTlyGC_A03PU1zURtLsXuAp-sOCks5vV9VWgaJpZM4bpfaw.

danieljoos commented 5 years ago

Ah, I was indeed only trying to compile wasm1 and wasm3. Looking at the changelog, I found that they renamed the function: https://golang.org/doc/go1.12#minor_library_changes It is now called FuncOf. I'll adapt the examples later today. Thanks for finding this issue.

danieljoos commented 5 years ago

Alright, should be fixed with e1311efb5f2b7fd05a264b0b38c2ad3110746ce5