Skip to content

Commit f3e0687

Browse files
Zxillygopherbot
authored andcommitted
WebAssembly: update support file location
with https://golang.org/cl/604696 Updates golang/go#68024 Change-Id: Ia17d0beee2d2ba395788d9a2a7dea8ec88ba6f8f GitHub-Last-Rev: 365f2d4 GitHub-Pull-Request: #22 Reviewed-on: https://go-review.googlesource.com/c/wiki/+/604119 Reviewed-by: Johan Brandhorst-Satzkorn <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]>
1 parent 4b1de68 commit f3e0687

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

WebAssembly.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ page.
3131

3232
> If you are on Windows, we suggest to follow this tutorial using a BASH emulation system such as Git Bash.
3333
34+
> For Go 1.23 and earlier, the wasm support files needed in this article are located in `misc/wasm`, and the path should be replaced when performing operations with files such as `lib/wasm/wasm_exec.js`.
35+
3436
To compile a basic Go package for the web:
3537

3638
```go
@@ -63,7 +65,7 @@ support file, and a HTML page to connect everything together.
6365
Copy the JavaScript support file:
6466

6567
```sh
66-
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
68+
cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" .
6769
```
6870

6971
Create an `index.html` file:
@@ -120,12 +122,12 @@ rather than a browser, which can be useful for testing and automation.
120122

121123
First, make sure Node is installed and in your `PATH`.
122124

123-
Then, add `$(go env GOROOT)/misc/wasm` to your `PATH`.
125+
Then, add `$(go env GOROOT)/lib/wasm` to your `PATH`.
124126
This will allow `go run` and `go test` find `go_js_wasm_exec` in a `PATH` search
125127
and use it to just work for `js/wasm`:
126128

127129
```console
128-
$ export PATH="$PATH:$(go env GOROOT)/misc/wasm"
130+
$ export PATH="$PATH:$(go env GOROOT)/lib/wasm"
129131
$ GOOS=js GOARCH=wasm go run .
130132
Hello, WebAssembly!
131133
$ GOOS=js GOARCH=wasm go test
@@ -137,15 +139,15 @@ If you're running working on Go itself, this will also allow you to run `run.bas
137139
seamlessly.
138140

139141
`go_js_wasm_exec` is a wrapper that allows running Go Wasm binaries in Node. By default,
140-
it may be found in the `misc/wasm` directory of your Go installation.
142+
it may be found in the `lib/wasm` directory of your Go installation.
141143

142144
If you'd rather not add anything to your `PATH`, you may also set the `-exec` flag to
143145
the location of `go_js_wasm_exec` when you execute `go run` or `go test` manually.
144146

145147
```console
146-
$ GOOS=js GOARCH=wasm go run -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec" .
148+
$ GOOS=js GOARCH=wasm go run -exec="$(go env GOROOT)/lib/wasm/go_js_wasm_exec" .
147149
Hello, WebAssembly!
148-
$ GOOS=js GOARCH=wasm go test -exec="$(go env GOROOT)/misc/wasm/go_js_wasm_exec"
150+
$ GOOS=js GOARCH=wasm go test -exec="$(go env GOROOT)/lib/wasm/go_js_wasm_exec"
149151
PASS
150152
ok example.org/my/pkg 0.800s
151153
```
@@ -154,10 +156,10 @@ Finally, the wrapper may also be used to directly execute a Go Wasm binary:
154156

155157
```console
156158
$ GOOS=js GOARCH=wasm go build -o mybin .
157-
$ $(go env GOROOT)/misc/wasm/go_js_wasm_exec ./mybin
159+
$ $(go env GOROOT)/lib/wasm/go_js_wasm_exec ./mybin
158160
Hello, WebAssembly!
159161
$ GOOS=js GOARCH=wasm go test -c
160-
$ $(go env GOROOT)/misc/wasm/go_js_wasm_exec ./pkg.test
162+
$ $(go env GOROOT)/lib/wasm/go_js_wasm_exec ./pkg.test
161163
PASS
162164
ok example.org/my/pkg 0.800s
163165
```

0 commit comments

Comments
 (0)