go-wasm
go-wasm copied to clipboard
examples seem broken
Both of the examples seem broken. I'm on go1.13.5. The caller example uses a non-existent FromBytes function. The http example errors with:
panic: Failed to instantiate the module:
2 link errors: (1 of 2) Import not found, namespace: go, name: syscall/js.copyBytesToGo (2 of 2) Import not found, namespace: go, name: syscall/js.copyBytesToJS
in the BridgeFromFile function.
If I use the main.wasm
file from this repo it works. But if I compile it myself (from the examples/http-wasm
directory):
GOOS=js GOARCH=wasm go build
then the above error occurs. How did you produce the .wasm files in this repo?
@mjibson could you tell me the Go version you are using ? ATM, it only supports go 1.13 since there are breaking changes in next or previous versions of Go since WASM is not in Go1 compatibilty
You can re build wasm like this
GOOS=js GOARCH=wasm go build -o main.wasm ./examples/function-wasm/...
GOOS=js GOARCH=wasm go build -o main.wasm ./examples/http-wasm/...