![]() The version of tinygo you are using to compile. Ensure you are using the same version of wasm_exec.js as It isīased on $GOROOT/misc/wasm/wasm_exec.js from the standard library, but is We have defined these in tinygo/targets/wasm_exec.js. How it worksĮxecution of the contents require a few JS helper functions which are calledįrom WebAssembly. More complete examples are provided in the wasm examples. Make sure you copy wasm_exec.js to your runtime environment: docker run -v $GOPATH:/go -e "GOPATH=/go" tinygo/tinygo:0.27.0 /bin/bash -c "cp /usr/local/tinygo/targets/wasm_exec.js /go/src//myuser/myrepo/ Also note that you must change the path to your Wasm file from /go/src//myuser/myrepo/wasm-main.go to whatever the actual path to your file is: docker run -v $GOPATH:/go -e "GOPATH=/go" tinygo/tinygo:0.27.0 tinygo build -o /go/src//myuser/myrepo/wasm.wasm -target wasm -no-debug /go/src//myuser/myrepo/wasm-main.go Note the -no-debug flag, which reduces the size of the final binary by removingĭebug symbols from the output. If you’re using the docker image, you need to mount your workspace into the image. If you have tinygo installed, it’s as simple as providing the correct target: tinygo build -o wasm.wasm -target wasm. ![]() You can also simply execute code in func main(), like in the standard library This part goes after "const go = new Go() " declaration.Ĭonsole. Providing the environment object, used in WebAssembly.instantiateStreaming. ![]()
0 Comments
Leave a Reply. |