-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/distpack: wasm runtime js should be kept in the toolchain package #68024
Comments
It looks like an intentional decision in CL 470676 that the module toolchain isn't complete to run all tests, as it doesn't keep the "test" directory either: The scripts in the misc/wasm directory can be fetched from the source or binary toolchain distributions. |
I agree with this, but |
@dmitshur - Just chiming in here. Downloading the file during running a test isn't a great experience either because one should be able to run tests without any internet connection. Wondering if this decision can be revisited and the cc @rsc for a decision as well. |
misc files should not be included in toolchains, full stop. misc is by definition a dumping ground. If there are required supporting files that should be included in toolchains, they should be moved somewhere else. Perhaps lib/wasm. |
Did this move needs a proposal? |
Happy to do that. cc @neelance for alignment on a decision. Richard, please see the thread above for some context. |
Moving wasm_exec.js sounds good to me. Please submit a CL if you can Agniva. |
Oh, there was a thumbs up from Richard. Never saw that until now. 😄 Will do. |
Change https://go.dev/cl/604696 mentions this issue: |
Change https://go.dev/cl/604119 mentions this issue: |
Change https://go.dev/cl/604835 mentions this issue: |
I'm a little concerned that this will make any posts explaining how to use Wasm with Go outdated. We'll at the very least want to update the official wasi blog post (https://go.dev/blog/wasi) and Wasm wiki (https://go.dev/wiki/WebAssembly) to coincide with the release of this change. There might be other places too. I'm not sure how to best communicate this change to the Go Wasm community at large though. |
Maybe we could keep a soft link in |
If that's something we can support, maybe, but I don't know if we have precedence for that sort of thing, or even capability for all releases. |
I agree that unless it's strictly necessary it doesn't need to be in the toolchain. Only |
I'm still confused about how go toolchain users can access these exec wrappers. |
The exec wrappers are just conveniences. Users can write their own exec wrappers if they need something. Not every user will need an exec wrapper to execute the compiled code. |
So we need to updates many document to indicate that these scripts are not avaiable while using GoToolChain? |
Uses of |
Hey all, just wanted to check in on this. Thank you @Zxilly for dilligently addressing the review comments. @cherrymui - It sounds like adding further documentation updates for users depending on the default exec wrappers should be acceptable. Can we move forward with the changes then? |
I moved this issue to NeedsDecision to better reflect its latest state, given the discussion here and on CL 604696. To expand on that: it seems there's agreement that the wasm_exec.js and wasm_exec_node.js files should be included in toolchain zips, and that the wasm_exec.html example should stay in misc/wasm (and not be included in toolchain zips). The remaining question is about the go_*_wasm_exec programs that help with running GOARCH=wasm code via There are two paths forward being currently discussed, as I understand them:
Let's get to a decision here, and then the CL can be updated to reflect that. Thanks. |
Thanks Dmitri. Sounds to me like approach 1 is just going to make life a bit more painful for folks working with downloaded toolchains? What exactly are we gaining by not including the exec wrappers? I thought the original issue was more about renaming misc/wasm to lib/wasm. To me, it feels like we have little to lose, but more to gain by including those files. But will defer to others here. |
I chose option 2 because GoToolchain is more of an implicit mechanism. If a user doesn't know about GoToolchain, it will be difficult for him to understand why files present in his Go installation are not accessible. |
It seems most people think it helpful to include the exec wrappers. I think that is fine. One difference for the exec wrappers are that, unlike most things included in the release which are ready to be used on production, the exec wrappers are mostly intended for local uses. I guess it is not much of a problem given the nature of the exec wrappers? And perhaps the convenience of using the exec wrapper with automatic toolchain switch overweighs. |
Yep exactly. IMO, it's an overall net gain. |
Based on discussion above, it sounds like there's agreement: for Go 1.24, the .js files are moved to lib/wasm, as well as the exec scripts. The .html file isn't moved. It's a bit unusual to have executables in a lib directory but it shouldn't cause problems (and if there's a good reason to find a better long term location for them, that can still happen in a future issue). This makes it possible to refer to files in $(go env GOROOT)/lib/wasm directory for the currently selected Go toolchain even after using https://go.dev/doc/toolchain#download. Let's give this a bit more time and move it to NeedsFix if there aren't new concerns. |
Once this change lands, we can address the documentation concern by creating a 1.24 release blocking issue to update the documentation along with the release (bloc post, wiki, etc). What's more concerning is that this doesn't work right now |
Filed #69175 to track the remaining work of updating relevant documentation. |
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 <johan.brandhorst@gmail.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Updates golang/go#68024 Change-Id: If33d8641114a2b0c0e6d70b3dd4e8683ed24b359 GitHub-Last-Rev: b641500 GitHub-Pull-Request: #101 Reviewed-on: https://go-review.googlesource.com/c/build/+/604835 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Updates golang/go#68024 Change-Id: I6642d366d292f2ce30f5d49b46e85f175b459914 GitHub-Last-Rev: 7fbfab2 GitHub-Pull-Request: #298 Reviewed-on: https://go-review.googlesource.com/c/website/+/604916 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Eli Bendersky <eliben@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
why not just include the exec js without breaking all the blog and makefiles out there by changing the location? (ie stay where it’s been but only pick the needed files instead of all of misc/) |
go 1.22.5 -> in /misc go 1.24.0 -> in /lib See golang/go#68024 See golang/go#69989
Go version
go version go1.22.0 windows/amd64
Output of
go env
in your module/workspace:What did you do?
https://go.dev/wiki/WebAssembly#running-tests-in-the-browser
Try to run wasm test follow the official document. The Go Toolchain overwrites
GOROOT
env thus thewasmbrowsertest
can not find thewasm_exec.js
I also report this to wasmbrowsertest at agnivade/wasmbrowsertest#61
What did you see happen?
What did you expect to see?
Test success.
The text was updated successfully, but these errors were encountered: