-
Notifications
You must be signed in to change notification settings - Fork 0
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
Decide on API for github.com/gopherjs/gopherjs/build #42
Comments
Since this issue is about the
Given our limited resources (per gopherjs#894), I think this is a viable cost-cutting measure to take. The way I see it, it's a limitation of the upstream Go project. Before modules, We can consider alternatives to make it work, such as:
However, I don't think the GopherJS Playground working as it does today should block GopherJS gaining support for modules. I think we should add module support, and work on the GopherJS Playground orthogonally (if anyone has time left to do so, otherwise it will stay at 1.11.5 until someone does). |
The jsgo compiler and playground will have exactly the same limitations. The jsgo compiler does compilation server-side, but it does it all in-memory. It would need significant changes to work with |
Please try not to change the call signature of gopherjs/build. |
For module support, GopherJS needs to use the
go
tool under the hood (strictly speaking we could sit GopherJS atopgo/packages
to make it build tool agnostic, but we haven't done that for now).But the Playground (https://gopherjs.github.io/playground/) runs
github.com/gopherjs/gopherjs/build
in-browser. Hence it does not have thego
tool available. The Playground is, however, limited to standard library imports.jsgo
is more advanced in that it can handle non-standard library imports.Hence in its most basic form we need to make
github.com/gopherjs/gopherjs/build
be driven by some sort of "driver" that knows how to resolve import paths (in some context). The simplest way to do that will be to provide an implementation of the following interface:The
Package
type here is a cut-down version of https://godoc.org/golang.org/x/tools/go/packages#Package that will also have a field:for subsequently opening files listed in the
Package
.where:
This is, in effect, the last remaining piece of work to bring full module support to GopherJS. Given the command line version of GopherJS works just fine as of https://github.com/myitcv/gopherjs/tree/f5b96be2a04cf73ef5198ad6520e80375fd9764b, we could decide to leave
github.com/gopherjs/gopherjs/build
as broken for now, merge the command line module support upstream and revisit at a later date. This would be at the cost of the playground which would be stuck on Go 1.11.5.Any thoughts/contributions on the above welcome.
cc @hajimehoshi @paralin @dave @dmitshur
The text was updated successfully, but these errors were encountered: