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

$GOPATH/src/github.com/gopherjs/gopherjs/js used during compilation #1193

Open
flimzy opened this issue Jun 5, 2023 · 3 comments
Open

$GOPATH/src/github.com/gopherjs/gopherjs/js used during compilation #1193

flimzy opened this issue Jun 5, 2023 · 3 comments

Comments

@flimzy
Copy link
Member

flimzy commented Jun 5, 2023

If $GOPATH/src/github.com/gopherjs/gopherjs/js happens to exist at the time GopherJS is compiled, this version of the package is used rather than the version embedded in the virtual file system. This can lead to an unusable gopherjs binary, in the case of mismatched versions.

@nevkontakte
Copy link
Member

I suspect this isn't so much as our bug as go/build one. This would be a great deal easier to fix after #1021, especially if we switch to go/packages instead of go/build (which support for modules is incomplete and somewhat buggy).

@flimzy
Copy link
Member Author

flimzy commented Jun 8, 2023

Your comment got me thinking... it would be strange for the actual compilation process to use $GOPATH/src in module mode... so makes me wonder if this is a problem with go generate. I'll do some investigation to try to pin down the cause. If it is related to generating our VFS, then the switch to embed may help.

@nevkontakte
Copy link
Member

So here we fall back to the embedded VFS if the primary build context doesn't find a package. This was done to avoid weirdness when a projects go.mod specifies a particular version of the js package. The problem is that go/build shouldn't look for packages in $GOPATH when working in the go.mod environment, but I bet because modules support was retrofitted into it as an afterthought it still prioritizes $GOPATH 😕

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

2 participants