diff --git a/WebAssembly.md b/WebAssembly.md index 1cac5e3..ed94e65 100644 --- a/WebAssembly.md +++ b/WebAssembly.md @@ -7,6 +7,12 @@ As there are differences between the latest Go and Go 1.11 beta, I recommend to After that, use the compiled `go` binary. +# Compile your game + +```sh +GOOS=js GOARCH=wasm /path/to/latest/gocode/bin/go build -o yourgame.wasm github.com/yourname/yourgame +``` + # Create an HTML ```html @@ -22,7 +28,7 @@ if (!WebAssembly.instantiateStreaming) { } const go = new Go(); -WebAssembly.instantiateStreaming(fetch("sprites.wasm"), go.importObject).then(result => { +WebAssembly.instantiateStreaming(fetch("yourgame.wasm"), go.importObject).then(result => { go.run(result.instance); });