Skip to content

Support for vgo builds outside GOPATH #835

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

Closed
bfreis opened this issue Jun 24, 2018 · 10 comments
Closed

Support for vgo builds outside GOPATH #835

bfreis opened this issue Jun 24, 2018 · 10 comments

Comments

@bfreis
Copy link

bfreis commented Jun 24, 2018

Hi,

I have no clue how easy or difficult this would be. Any chance of adding support for looking up packages the way vgo does? It allows go modules to be built outside of the GOPATH, and it looks up dependencies in $GOPATH/go/src/mod/${IMPORT_PATH}@${VERSION}/, where import_path and version are as defined in the go.mod file in the project folder.

I've never looked into GopherJS code, but I'm assuming this wouldn't be terribly complicated?

Cheers!
Bruno

@flimzy
Copy link
Member

flimzy commented Jun 24, 2018

Wouldn't this break compatibility with go?

@bfreis
Copy link
Author

bfreis commented Jun 25, 2018

Hi @flimzy ,

I can't say for sure, as I'm not knowledgeable of the internals of either GopherJS, Vgo toolchain, or Go toolchain.

But what I can say is that, from a practical perspective, it seems that the VGo binary behaves exactly like the Go binary in "normal" Golang codebases (ie, with a "traditional" GOPATH). To "activate" the special features, you have to create a file called go.mod.

So I would assume that it wouldn't break compatibility - VGo is intended to be released as part of Go 1.11, AFAIK. If they don't break the "promise of compatibility", it should be compatible.

Cheers!
Bruno

@myitcv
Copy link
Member

myitcv commented Jun 25, 2018

@bfreis @flimzy - this should be possible. At the moment GopherJS uses go/build for package discovery; this will need to be replaced by something like the planned go/packages.

@flimzy
Copy link
Member

flimzy commented Jun 25, 2018

If this is slated for inclusion in Go 1.11, doesn't it make sense for GopherJS to wait until Go 1.11, as well?

I'd be very concerned about projects that work with both Go and GopherJS, being treated differently in the two environments. In this sense, retaining backward compatibility isn't the only compatibility concern.

@myitcv
Copy link
Member

myitcv commented Jun 25, 2018

If this is slated for inclusion in Go 1.11, doesn't it make sense for GopherJS to wait until Go 1.11, as well?

Sorry, yes, agreed - that was implicit in my answer. Arguably we could/should wait for an initial cut of go/packages to land first too (although that's not strictly necessary, might just save us some work).

@myitcv
Copy link
Member

myitcv commented Jul 6, 2018

Just an FYI on this issue, I am working on vgo support for GopherJS, support that will be in-line with the experimental release of vgo within Go 1.11.

This will initially be be merged into https://github.com/myitcv/gopherjs.

I will also raise a PR against this repo, but I know @shurcooL has a lot on at the moment.

@g5becks
Copy link

g5becks commented Oct 9, 2018

@myitcv any updates on this?

@myitcv
Copy link
Member

myitcv commented Oct 24, 2018

@Gee5ive (and others) I've just merged the changes in the go1.11 branch of https://github.com/myitcv/gopherjs into master (of that fork) and created a go1.10 branch for posterity.

@flimzy
Copy link
Member

flimzy commented Apr 9, 2021

I'm closing this in favor of #855, which is an effective duplicate, after modules have been made official.

@flimzy flimzy closed this as completed Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants