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

support being built and used with newer versions of Go #966

Merged
merged 2 commits into from Feb 9, 2020

Conversation

@dmitshur
Copy link
Member

dmitshur commented Feb 8, 2020

This change removes the build-time check that GopherJS was built
with Go version 1.12, and replaces it with a runtime check instead.

Add and document a new GopherJS-specific environment variable:

GOPHERJS_GOROOT - if set, GopherJS uses this value as the default GOROOT value,
                  instead of using the system GOROOT as the default GOROOT value

The main reason that GopherJS required Go 1.12 to be built in the
past was as a way of ensuring that the Go 1.12 standard library
code is available on disk, which GopherJS 1.12-2 needs to build
Go code. Now that the Go distribution can provided to GopherJS
with convenience via the GOPHERJS_GOROOT environment variable,
we can allow GopherJS to be built with a newer version of Go,
as long as a Go 1.12 distribution is provided via GOPHERJS_GOROOT.

Update GopherJS installation instructions to support being installed
with Go 1.12 and newer versions of Go.

The Go distribution version check is added to build.NewSession.
That check may fail, and so it was necessary to add an error return
value to the signature of build.NewSession. The build API is deemed
semi-internal, so a breaking API change is unfortunate but acceptable.

Regenerate ./compiler/natives with:

go generate ./...

Fixes #941

This change removes the build-time check that GopherJS was built
with Go version 1.12, and replaces it with a runtime check instead.

Add and document a new GopherJS-specific environment variable:

	GOPHERJS_GOROOT - if set, GopherJS uses this value as the default GOROOT value,
	                  instead of using the system GOROOT as the default GOROOT value

The main reason that GopherJS required Go 1.12 to be built in the
past was as a way of ensuring that the Go 1.12 standard library
code is available on disk, which GopherJS 1.12-2 needs to build
Go code. Now that the Go distribution can provided to GopherJS
with convenience via the GOPHERJS_GOROOT environment variable,
we can allow GopherJS to be built with a newer version of Go,
as long as a Go 1.12 distribution is provided via GOPHERJS_GOROOT.

Update GopherJS installation instructions to support being installed
with Go 1.12 and newer versions of Go.

The Go distribution version check is added to build.NewSession.
That check may fail, and so it was necessary to add an error return
value to the signature of build.NewSession. The build API is deemed
semi-internal, so a breaking API change is unfortunate but acceptable.

Regenerate ./compiler/natives with:

	go generate ./...

Fixes #941
@dmitshur dmitshur force-pushed the runtime-version-check branch from 413cd88 to 991490c Feb 8, 2020
@dmitshur

This comment has been minimized.

Copy link
Member Author

dmitshur commented Feb 8, 2020

/cc @hajimehoshi Feel free take a look if you have time (and it's okay if not, due to #894).

If there aren't major problems with this, I plan to merge this later today, and follow up if any problems are discovered in the near future.

I've been using the less polished pre-force-push version of this change locally for many months now and didn't spot any problems.

compiler/version_check.go Outdated Show resolved Hide resolved
Copy link
Member

hajimehoshi left a comment

LGTM

tests/run.go Show resolved Hide resolved
@dmitshur dmitshur merged commit f9cef59 into master Feb 9, 2020
1 check passed
1 check passed
ci/circleci Your tests passed on CircleCI!
Details
@dmitshur dmitshur deleted the runtime-version-check branch Feb 9, 2020
@dmitshur

This comment has been minimized.

Copy link
Member Author

dmitshur commented Feb 9, 2020

Thanks for reviewing.

I'll be watching the issue tracker and follow up if anything comes up.

dmitshur added a commit to shurcooL/gopherjslib that referenced this pull request Feb 9, 2020
This is possible because the GopherJS compiler supports being
built with newer versions of Go as of gopherjs/gopherjs#966.

As of Go 1.12, go tool vet is no longer supported.¹
Start using the go vet command instead.

Use RCS format for gofmt diff. It results in cleaner,
easier to read gofmt diffs.

¹ https://golang.org/doc/go1.12#vet
@dmitshur

This comment has been minimized.

Copy link
Member Author

dmitshur commented Feb 9, 2020

I'll bump the (minor) version of GopherJS and advertise this change on Twitter.

dmitshur added a commit that referenced this pull request Feb 9, 2020
This is the first version of GopherJS that can be built
and used with a newer major version of Go (PR #966).
Give it a new version number so it's easier to refer to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.