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
opennota opened this Issue Nov 1, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@opennota

opennota 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 label Nov 4, 2018

@dmitshur dmitshur added this to the Unplanned milestone Nov 4, 2018

@dmitshur dmitshur added the NeedsFix label Nov 4, 2018

@neelance

This comment has been minimized.

Member

neelance commented Nov 10, 2018

Did you set GOOS=js and GOARCH=wasm?

@opennota

This comment has been minimized.

opennota 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

This comment has been minimized.

Member

neelance commented Nov 10, 2018

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

This comment has been minimized.

gopherbot commented Nov 10, 2018

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

@gopherbot gopherbot closed this in 339e5ff Nov 20, 2018

bradfitz pushed a commit that referenced this issue Nov 21, 2018

go/doc: disable playground for examples that use syscall/js
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

This comment has been minimized.

Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment