dylanpoe opened issue #8841:
hello, I use golang build a main.wasm files
//go:build js && wasm // main.go package main import ( "syscall/js" ) func main() { js.Global().Call("alert", "Hello World") }
and build the main.wasm by the code
GOOS=js GOARCH=wasm go build -o main.wasm
then use the wasmtime main.wasm, got the error
Error: failed to run main module `main.wasm` Caused by: 0: failed to instantiate "main.wasm" 1: unknown import: `gojs::runtime.scheduleTimeoutEvent` has not been defined
hot t fix it ?
bjorn3 commented on issue #8841:
GOOS=js uses a Go specific syscall interface which is only implemented by the JS code available at https://github.com/golang/go/blob/master/misc/wasm/wasm_exec.js This only works in the browser and with Node.JS and is incompatible with any native WASM runtime. For Wasmtime and other native WASM runtimes you have to use GOOS=wasip1 instead and are not allowed to use the
syscalls/js
package.
alexcrichton closed issue #8841:
hello, I use golang build a main.wasm files
//go:build js && wasm // main.go package main import ( "syscall/js" ) func main() { js.Global().Call("alert", "Hello World") }
and build the main.wasm by the code
GOOS=js GOARCH=wasm go build -o main.wasm
then use the wasmtime main.wasm, got the error
Error: failed to run main module `main.wasm` Caused by: 0: failed to instantiate "main.wasm" 1: unknown import: `gojs::runtime.scheduleTimeoutEvent` has not been defined
hot t fix it ?
Last updated: Nov 22 2024 at 16:03 UTC