Skip to content
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

go/doc: example for syscall/js.NewCallback doesn't run #28526

Closed
ghost opened this issue Nov 1, 2018 · 5 comments
Closed

go/doc: example for syscall/js.NewCallback doesn't run #28526

ghost opened this issue Nov 1, 2018 · 5 comments
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ghost
Copy link

ghost commented Nov 1, 2018

Following #28492: the example for NewCallback (https://golang.org/pkg/syscall/js/#NewCallback) has the Run button but doesn't run, because

prog.go:5:2: build constraints exclude all Go files in /usr/local/go/src/syscall/js

@dmitshur dmitshur added the arch-wasm WebAssembly issues label Nov 4, 2018
@dmitshur dmitshur added this to the Unplanned milestone Nov 4, 2018
@dmitshur dmitshur added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 4, 2018
@neelance
Copy link
Member

Did you set GOOS=js and GOARCH=wasm?

@ghost
Copy link
Author

ghost commented Nov 10, 2018

@neelance Nope. I don't have access to golang.org (which presumably runs the examples).

https://i.imgur.com/SAOCopY.png

@neelance
Copy link
Member

Oh sorry, I jumped to conclusions without reading the issue closely enough (there have been other issues caused by missing GOOS and GOARCH). Yes, this example shouldn't have a "Run" button.

@gopherbot
Copy link

Change https://golang.org/cl/148918 mentions this issue: go/doc: disable playground for examples that use syscall/js

bradfitz pushed a commit that referenced this issue Nov 21, 2018
The playground is not using GOOS=js, so it is not able to use the
package syscall/js. Examples that depend on syscall/js should not
show a "Run" button.

Fixes #28526.

Change-Id: I8b2fcdd0c0ee517a5c3864bf459f813129542389
Reviewed-on: https://go-review.googlesource.com/c/148918
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@dmitshur
Copy link
Contributor

dmitshur commented Nov 27, 2018

I noticed something in os/exec package documentation related to this issue. Namely, it includes the following paragraph in the package documentation:

Note that the examples in this package assume a Unix system. They may not run on Windows, and they do not run in the Go Playground used by golang.org and godoc.org.

It seems os/exec went with another way of handling a similar problem.

/cc @neelance @bradfitz FYI.

@golang golang locked and limited conversation to collaborators Nov 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants