AchalaSB / Go-wasm

Golang Calculator using WASM interpreter
0 stars 0 forks source link

problem compiling on go1.12.3 #1

Open mahan77 opened 5 years ago

mahan77 commented 5 years ago

Hi I have problem compiling this on go1.12.3 darwin/amd64. I believe go webassambley term drop js.NewCallback to js.FuncOf.
I’m learning go, its very hard to figure out this Can you help on this. This is the error message

command-line-arguments

./main.go:56:25: undefined: js.NewCallback ./main.go:57:30: undefined: js.NewCallback ./main.go:58:27: undefined: js.NewCallback ./main.go:59:25: undefined: js.NewCallback ./main.go:60:29: undefined: js.NewCallback

Regards mahan

AchalaSB commented 4 years ago

Hi @mahan77

Sorry for the delay. have you installed syscall/js package. is that giving you any error. (try go get syscall/js)

The code is working file on go1.12 ubuntu 18.04. While you are running main.go you may get with this error. Set properly your GOROOT and GOPATH

go run main.go
main.go:7:2: build constraints exclude all Go files in /usr/lib/go/src/syscall/js

command to run this go run server.go

If it fails to run server you can install http server packages like and run server

go get github.com/tapirliu/golf

Thanks