Skip to content

Avoid build failures with Go 1.21.0 installed in the environment. #1232

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

Merged

Conversation

makiuchi-d
Copy link
Contributor

$ GOPHERJS_GOROOT="$(go1.18.10 env GOROOT)" gopherjs build
failed to expand patterns []: failed to list packages in the primary context: failed to list packages on FS: go tool error: /home/makki/Development/go/bin/go list -e -compiler=gc -tags=netgo,purego,math_big_pure_go,gopherjs -installsuffix= -f={{.ImportPath}} --: exit status 1
go: updates to go.mod needed; to update it:
        go mod tidy

This error occurred when the built module targets a version earlier than go 1.21.0 in go.mod, while the imported package targets go 1.21.0.
In such cases, go 1.21.0 requires us to run go mod tidy, which was not required in previous versions of go.

Please see the example for detail: github.com/makiuchi-d/gopherjs-fail-example

In the GopherJS build process, gopherjs calls go, and go 1.21.0 is used when it's installed under the $PATH.
To avoid this error, we should use $GOPHERJS_GOROOT/bin/go instead of the go under the $PATH.

Copy link
Member

@nevkontakte nevkontakte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@nevkontakte nevkontakte merged commit 67d465f into gopherjs:master Sep 2, 2023
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

Successfully merging this pull request may close these issues.

2 participants