-
Notifications
You must be signed in to change notification settings - Fork 12
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
Question: (How) Does the GopherJS playground handle includes? #73
Comments
The GopherJS playground currently does not support importing packages that are not part of the standard library. |
Do you happen to know if that is a design choice or if bringing the functionality up to date with the Go Playground (thus allowing includes) will be welcomed as a contribution? |
Closing issue due to lack of activity. |
@Potherca I only noticed this issue now, and I'm not the original author of the GopherJS playground, but I would guess that this is probably a technical limitation coming from the fact that the playground is purely client-side. Standard library packages are precompiled and packaged ahead of time, which allows them to be used. However, to import third-party packages, some kind of backend would have to be implemented and, more importantly, paid for. I presume the latter is why it wasn't done. |
Also see #26. Its "Implementation" section discussed two approaches, though more relevant to the GOPATH mode. The Go module mode was added 3 years later and creates new possibilities to fetch dependencies. The module mirror also allows CORS requests. So more frontend heavy implementations (i.e., the GopherJS Playground could download and compile third party dependencies... inside the user's browser) should also be viable now. |
Thanks for the clarification @nevkontakte and @dmitshur! |
I have a simple piece of code.
When I run it in the Go Playground it works as expected.
However, when I run similar code in the GopherJS payground it gets an error:
Am I doing something wrong or does the GopherJS playground not support
includes
in the same way the Go Playground does?Click to expand/collapse code
The text was updated successfully, but these errors were encountered: