Description: previous versions of gopherjs just run with one version of go
             this patch is cherry picked from upstream an enables working on 
             any version
Author: Thorsten Alteholz <debian@alteholz.de> and upstream
Index: golang-github-gopherjs-gopherjs.dev/README.md
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/README.md	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/README.md	2020-04-08 10:09:50.360655317 +0200
@@ -13,12 +13,22 @@
 Nearly everything, including Goroutines ([compatibility table](https://github.com/gopherjs/gopherjs/blob/master/doc/packages.md)). Performance is quite good in most cases, see [HTML5 game engine benchmark](https://ajhager.github.io/engi/demos/botmark.html). Cgo is not supported. Using a vendored copy of GopherJS is currently not supported, see [#415](https://github.com/gopherjs/gopherjs/issues/415).
 
 ### Installation and Usage
+GopherJS requires Go 1.12 or newer.
+
 Get or update GopherJS and dependencies with:
 
 ```
 go get -u github.com/gopherjs/gopherjs
 ```
 
+If your local Go distribution as reported by `go version` is newer than Go 1.12, then you need to set the `GOPHERJS_GOROOT` environment variable to a directory that contains a Go 1.12 distribution. For example:
+
+```
+go get golang.org/dl/go1.12.16
+go1.12.16 download
+export GOPHERJS_GOROOT="$(go1.12.16 env GOROOT)"  # Also add this line to your .profile or equivalent.
+```
+
 Now you can use `gopherjs build [package]`, `gopherjs build [files]` or `gopherjs install [package]` which behave similar to the `go` tool. For `main` packages, these commands create a `.js` file and `.js.map` source map in the current directory or in `$GOPATH/bin`. The generated JavaScript file can be used as usual in a website. Use `gopherjs help [command]` to get a list of possible command line flags, e.g. for minification and automatically watching for changes.
 
 *Note: GopherJS will try to write compiled object files of the core packages to your $GOROOT/pkg directory. If that fails, it will fall back to $GOPATH/pkg.*
@@ -43,6 +53,15 @@
 
 If you include an argument, it will be the root from which everything is served. For example, if you run gopherjs serve github.com/user/project then the generated JavaScript for the package github.com/user/project/mypkg will be served at http://localhost:8080/mypkg/mypkg.js.
 
+#### Environment Variables
+
+There is one 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
+```
+
 ### Performance Tips
 
 - Use the `-m` command line flag to generate minified code.
Index: golang-github-gopherjs-gopherjs.dev/build/build.go
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/build/build.go	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/build/build.go	2020-04-08 10:20:42.339525237 +0200
@@ -25,6 +25,19 @@
 	"github.com/neelance/sourcemap"
 )
 
+// DefaultGOROOT is the default GOROOT value for builds.
+//
+// It uses the GOPHERJS_GOROOT environment variable if it is set,
+// or else the default GOROOT value of the system Go distrubtion.
+var DefaultGOROOT = func() string {
+	if goroot, ok := os.LookupEnv("GOPHERJS_GOROOT"); ok {
+		// GopherJS-specific GOROOT value takes precedence.
+		return goroot
+	}
+	// The usual default GOROOT.
+	return build.Default.GOROOT
+}()
+
 type ImportCError struct {
 	pkgPath string
 }
@@ -34,8 +47,9 @@
 }
 
 func NewBuildContext(installSuffix string, buildTags []string) *build.Context {
+        //gopherjsRoot := filepath.Join(DefaultGOROOT, "src", "github.com", "gopherjs", "gopherjs")
 	return &build.Context{
-		GOROOT:        build.Default.GOROOT,
+                GOROOT:        DefaultGOROOT,
 		GOPATH:        build.Default.GOPATH,
 		GOOS:          build.Default.GOOS,
 		GOARCH:        "js",
@@ -122,10 +136,10 @@
 		pkg.PkgObj = filepath.Join(pkg.BinDir, filepath.Base(pkg.ImportPath)+".js")
 	}
 
-	if _, err := os.Stat(pkg.PkgObj); os.IsNotExist(err) && strings.HasPrefix(pkg.PkgObj, build.Default.GOROOT) {
+	if _, err := os.Stat(pkg.PkgObj); os.IsNotExist(err) && strings.HasPrefix(pkg.PkgObj, DefaultGOROOT) {
 		// fall back to GOPATH
 		firstGopathWorkspace := filepath.SplitList(build.Default.GOPATH)[0] // TODO: Need to check inside all GOPATH workspaces.
-		gopathPkgObj := filepath.Join(firstGopathWorkspace, pkg.PkgObj[len(build.Default.GOROOT):])
+		gopathPkgObj := filepath.Join(firstGopathWorkspace, pkg.PkgObj[len(DefaultGOROOT):])
 		if _, err := os.Stat(gopathPkgObj); err == nil {
 			pkg.PkgObj = gopathPkgObj
 		}
@@ -411,15 +425,20 @@
 	Watcher  *fsnotify.Watcher
 }
 
-func NewSession(options *Options) *Session {
+func NewSession(options *Options) (*Session, error) {
 	if options.GOROOT == "" {
-		options.GOROOT = build.Default.GOROOT
+		options.GOROOT = DefaultGOROOT
 	}
 	if options.GOPATH == "" {
 		options.GOPATH = build.Default.GOPATH
 	}
 	options.Verbose = options.Verbose || options.Watch
 
+	// Go distribution version check.
+	if err := compiler.CheckGoVersion(options.GOROOT); err != nil {
+		return nil, err
+	}
+
 	s := &Session{
 		options:  options,
 		Archives: make(map[string]*compiler.Archive),
@@ -435,10 +454,10 @@
 		var err error
 		s.Watcher, err = fsnotify.NewWatcher()
 		if err != nil {
-			panic(err)
+			return nil, err
 		}
 	}
-	return s
+	return s, nil
 }
 
 func (s *Session) InstallSuffix() string {
Index: golang-github-gopherjs-gopherjs.dev/compiler/compiler.go
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/compiler/compiler.go	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/compiler/compiler.go	2020-04-08 10:09:50.364655482 +0200
@@ -17,7 +17,6 @@
 
 var sizes32 = &types.StdSizes{WordSize: 4, MaxAlign: 8}
 var reservedKeywords = make(map[string]bool)
-var _ = ___GOPHERJS_REQUIRES_GO_VERSION_1_9___ // Compile error on other Go versions, because they're not supported.
 
 func init() {
 	for _, keyword := range []string{"abstract", "arguments", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "eval", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "undefined", "var", "void", "volatile", "while", "with", "yield"} {
Index: golang-github-gopherjs-gopherjs.dev/compiler/natives/fs_vfsdata.go
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/compiler/natives/fs_vfsdata.go	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/compiler/natives/fs_vfsdata.go	2020-04-08 10:44:18.413918651 +0200
@@ -378,10 +378,9 @@
 		},
 		"/src/runtime/runtime.go": &vfsgen۰CompressedFileInfo{
 			name:             "runtime.go",
-			modTime:          mustUnmarshalTextTime("2017-06-28T23:32:11Z"),
-			uncompressedSize: 5338,
-
-			compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\xdb\x72\xdb\xbc\x11\xbe\x26\x9f\x62\xcb\x69\xff\x92\x8e\x22\xd9\x6e\x92\x4e\x33\xf5\x45\xa2\xc4\x4a\xa6\xb1\xe5\xb1\x9c\xf6\x9f\x49\x33\x19\x08\x5c\x4a\xb0\x40\x80\x05\x40\x1f\xe2\xf1\x03\xf4\x41\xfa\x62\x7d\x92\xce\x02\x3c\xc9\x96\x93\xb6\xbc\x11\xb5\xf8\x76\xb1\xd8\x13\x76\x39\x99\xc0\xb3\x65\x2d\x64\x0e\x97\x36\x8e\x2b\xc6\x37\x6c\x85\x60\x6a\xe5\x44\x89\x71\x2c\xca\x4a\x1b\x07\x69\x1c\x25\x0d\x6d\x22\x94\x43\xa3\x98\x9c\xd8\x5b\x9b\xc4\x71\x94\xac\x84\x5b\xd7\xcb\x31\xd7\xe5\x64\xa5\xab\x35\x9a\x4b\xdb\xbf\x5c\xda\x24\xce\xe2\x98\x6b\x65\x1d\xcc\xe6\xf3\x05\x1c\x81\xbd\xb5\x63\x7a\xed\xa8\x6f\xce\xa7\x1f\xe0\x08\x12\x02\x07\xda\x54\x97\x95\x90\x68\x88\xda\xca\x4a\xe2\x78\x32\x81\x82\x6d\x10\x0a\x6d\x00\x8d\xd1\x66\xbc\xd2\xb1\xbb\xad\x10\xb0\x60\x1c\xc1\x3a\x53\x73\x07\x77\x71\xf4\xcd\x53\xf7\xfc\x4f\x7c\x1f\x30\x81\xd6\x61\xee\xe3\xb8\xa8\x15\x87\xd4\x35\xb8\x8c\xd6\x84\x5a\xa5\xed\x0b\x09\x32\xe8\x6a\xa3\x20\x49\x3a\xbc\x50\xc2\xa5\x19\xad\x5d\xda\xb3\xcd\x0a\x5e\x1f\xc1\xa5\x1d\xcf\xa4\x5e\x32\x39\x9e\xa1\x4b\x93\xdf\x36\x76\xb4\x49\x16\x08\x3f\x33\x51\x46\xb2\x5a\x11\x0b\x2f\xe2\xd2\xce\x97\x97\xc8\xdd\x99\x33\xc9\x08\xfc\x4e\x41\x56\x20\xb7\x92\x2b\x67\x92\x6c\x27\xfb\x7b\xb2\xcf\x23\x6e\x4f\xfd\x19\xb3\x5b\x1b\x7d\x7d\x1e\xfc\x1d\x18\x48\xc6\xf8\x63\xe3\xf9\xa0\x41\xea\x51\xc4\x3e\x99\x00\xbb\xd2\x22\x87\x1c\x59\x0e\x5c\xe7\x08\x28\x45\x29\x14\x73\x42\xab\x38\xba\x62\x06\x30\xf8\x2b\x8e\x10\x8e\xe0\x97\x8b\xdb\x0a\xdf\x58\x8b\x86\x00\x7e\x87\xbb\xfb\x38\xfa\x06\x47\x80\x9d\x99\x67\xf3\xf3\xf9\xfc\x62\xcb\x17\x95\xd1\x1c\xad\xdd\x61\xf1\x66\x85\x0c\x29\x0a\x68\x71\x47\x1e\xf7\x59\xe5\x58\x08\x85\x39\x89\xe8\xfc\x39\x49\xe2\xe8\x3e\x8e\x56\xda\x68\xed\x48\x62\xc3\x14\xe4\xa1\xba\x6a\x8d\x14\xf4\x68\x24\x37\xf0\xdf\x3c\x2d\x38\x20\xc6\x8b\x26\x92\xfc\x26\xcd\x12\xc5\xfd\x3b\x2c\x58\x2d\xdd\xcc\xa3\xba\xb3\xbe\x35\xc8\x36\x95\x16\xaa\x0b\xac\xf1\x3b\x5c\xd6\xab\x15\x9a\x34\xeb\x50\x53\x26\x25\x9a\xd4\x6e\x44\x05\x42\xb9\x0c\xd2\x8a\x43\x2d\x94\xab\x9c\x19\x41\x21\x24\x36\xb6\x1a\x81\x14\x0a\x09\x33\x02\xbd\x81\xa5\xd6\xd2\x8b\x15\xaa\xd0\x3b\x8c\xd7\xc6\xc4\x29\x5e\xa7\xcd\xa1\xad\x63\x7c\x93\x64\x63\xda\x32\x4d\x6c\x25\x85\x4b\x46\x90\xfc\x5d\x25\xd9\xf8\xa3\xca\xf1\x26\x68\xf1\x0c\x0e\x83\x5d\xbc\xe4\x1f\x98\x7b\x7f\x04\x49\x32\xa2\x9f\x82\x49\x8b\xde\x2a\x15\x33\xce\xfb\x92\x98\xdb\x9d\xea\x65\x38\x42\x32\x1a\x92\x05\x6d\x39\x2f\x48\x85\xd4\x6b\xe0\xd2\xec\xd9\xc1\x53\x90\xac\x85\x3c\xd2\xff\x35\xb9\xb1\x57\xc9\x6b\xd0\x9c\x67\x3f\xeb\x7c\xb6\xbd\x70\xd0\x08\x1b\x81\x33\x35\x3e\x70\x86\xed\xbc\x31\x82\x8a\xc3\x97\xaf\x8d\x3b\x32\x22\x0d\xca\xc7\x3e\xf1\x4d\x26\x2d\xd7\xb1\x61\x25\x5a\x10\x16\x94\x76\x20\xca\x4a\x62\x89\xca\x61\xee\x2b\x5b\x28\x88\x47\x97\x76\x4c\x2c\x17\xf3\x77\xf3\xd7\xf0\xb1\xc5\x00\xc5\xb7\xb6\x56\x2c\x25\x8e\xb7\x54\x09\x42\x53\x1e\xfe\x0d\x75\xd9\x6b\xf6\xbb\x83\x46\x9d\x5f\x02\xe1\xee\x1e\xee\xe3\x50\x1b\x1b\x44\x28\x8e\x77\x5d\x69\xe4\xa2\x65\xce\xe0\x14\x6f\x28\x3c\xd3\x82\xfe\x07\x86\x11\x94\xda\x60\x1b\x60\xad\xf4\x2d\x99\x83\x9a\x7c\x36\x85\xf0\x34\x8a\xc5\xd1\x31\x6d\x42\xcf\x1e\xbd\x85\xff\x54\x12\x9a\x38\x8e\xa3\x63\x0a\x6a\x7a\x5a\xc2\x27\x0a\x6c\x7a\x84\x72\x71\xf4\x5e\x39\x73\x3b\x94\xd8\x15\x8f\xa9\x4f\xa4\xee\xaf\xc6\x9b\xbe\x68\x6f\xd7\x6a\x5e\x1b\xca\xc6\xda\x09\x85\x49\x16\x2a\x20\xa1\x93\xe0\xf0\xad\xf2\x18\xc2\x29\xd4\xc7\x64\x04\x4a\xc8\x6c\x50\xaf\x4e\xde\xfc\x7a\x76\x3e\x9f\x2e\x52\x15\xd2\x73\x3b\x04\x0e\x06\xda\x58\xbe\xc6\x3c\xa8\xc3\x29\x03\x4a\xb6\xc1\x94\xaf\x99\xea\x1c\xb0\x6b\x5b\x8b\xee\x42\x94\xa8\x6b\xb7\xb3\x1e\x93\x6c\x92\x09\x5c\x6a\x8b\x29\xcf\xe0\x3e\x1b\xc1\x7e\x16\x47\x7f\x7e\xce\xbb\xcd\x4f\xeb\x72\x7a\xf6\x39\x7d\x5a\xbb\xd3\xba\xec\xec\xf1\x08\xf6\xd0\x78\x4e\x3b\x26\x3b\xb8\x6d\x13\x2f\x6e\x43\xe0\x04\xcb\x85\x63\xce\x0e\xa2\x60\x32\x81\x19\x2a\x34\x4c\x82\x75\xcc\x09\xeb\x04\xb7\xe3\x38\x7a\x23\xa5\xe6\x7d\x7c\xbc\x7a\x01\x93\x09\x2c\x6f\x1d\x5a\x60\xb4\xc4\x28\x3d\x98\xca\xc1\x3a\x21\x25\x08\x05\x35\x15\x92\x0b\xd2\x20\xf0\x3e\xcd\x96\xe2\x15\x2a\xca\x9c\xc2\x20\xe6\x59\x1c\x2d\x6e\x2d\xc0\xee\xcd\xf4\xd2\x31\x5f\xbe\x0a\xa3\x4b\xaa\xd9\x0e\x4b\x48\x6d\x5d\x82\x2e\xe0\xd7\x9b\x1b\x62\x5d\xa2\xd4\xd7\x59\x1c\x7d\xd2\x7a\x53\x57\x76\x5b\x8c\xaa\xcb\x25\x1a\x42\xfb\x8a\x8e\x06\x64\x80\xc5\xd1\x89\x57\xe9\x49\x7c\x19\x96\xe3\xe8\xd8\x20\xda\x87\xea\xf5\x38\x3a\x85\x8d\xbd\x29\x4f\x98\x50\xed\x41\x29\x71\xd6\xc8\xaa\x6d\xbb\x7e\x40\x56\x75\xb6\xfd\x5f\x2c\x4b\x8c\x9d\x9d\xfe\x1b\x2b\x05\x96\x8f\x79\x93\xb2\x0f\x59\x84\x02\x41\x6b\xb6\x62\xca\x36\x58\x55\x5b\x7c\x02\xab\xb4\x7a\xde\xe1\x03\xfc\x1c\x25\x32\x8b\xf9\x23\xb8\x69\x17\x9c\x06\xb7\x46\x98\x2f\x02\x43\xc8\x0c\x3b\x94\xef\x23\x76\x60\xcb\xde\x02\x3a\x80\x83\x5d\x3f\xe9\xeb\xe7\x12\xaf\x50\x42\x21\x6e\x30\x7f\x6e\xc5\xf7\xb6\x94\xd5\x06\x5b\x2e\x6d\xb6\x6d\x3d\x99\x44\xe1\x48\xc2\x36\x9a\xd5\xa4\x95\xd2\xd7\x61\x91\xcc\xd9\x2d\xed\x32\xe1\x38\x8e\x16\x74\xf5\x36\x86\x79\x78\x4e\x2f\x6d\x79\x0b\xfe\x7a\xee\x95\x68\x98\x1a\x67\x05\xa6\x38\x3a\x59\x54\x4c\x3d\x12\x54\x92\x39\xfb\x93\xd8\x06\xf7\x90\x77\xca\xf8\x1a\x03\xf3\x80\x97\x13\x75\x9b\xd9\x03\x03\x77\xcb\xfc\xb6\xe6\x9b\x0f\xcc\xae\x89\xda\x33\x57\x46\x17\x42\x52\x27\xb7\xac\xf9\x06\x1d\xac\x99\x5d\x83\x63\x4b\x89\x71\x34\x9b\xf6\x19\xd9\xb3\xcc\xa6\x50\xa2\x63\x39\x73\x2c\x8e\xe6\x6e\x8d\x66\x4b\x4d\x82\x68\xa2\xb6\x59\xda\xe7\x41\xe3\xc5\x19\x33\x4b\x9a\x67\xb8\x96\x12\xf9\x23\x77\xd1\x8d\x36\x9b\x3e\x2e\x04\x0a\x6f\x5c\xcb\x43\x49\x75\x4d\x69\xb1\x66\x55\x85\x0a\xae\xd7\xa8\xa0\xcf\xa9\x7f\xff\xf3\x5f\xe0\xd6\xc2\x02\x2b\x75\x4d\x57\xd2\x27\x66\x77\xca\x44\x95\x03\xf5\xd3\x14\x73\x92\xd9\x2d\xf9\xa9\x62\x4a\x5b\xe4\x5a\xe5\x16\xac\x50\x1c\xe1\xe0\x4f\x7f\xa4\xca\x7d\xc6\x6a\x8b\xbe\xc4\x9d\xda\xde\xc0\x9e\x7a\xda\xda\xeb\xcb\xe1\xcb\x57\x5f\xfb\x8d\xb8\x30\xbc\x96\xcc\xc0\xb2\x2e\x8a\x10\xe3\x06\x39\x75\x0e\xb3\x29\x54\xc4\x09\x79\x6d\x82\x95\xe8\xfe\xb6\xae\x5d\x67\x0e\xbe\xa4\x54\xfe\xa7\xcf\x0e\x5f\xbe\xcc\x7e\x47\x72\x9b\xcd\xde\xab\xfc\xff\xdd\xac\x3d\xb8\x8d\x23\x2f\x1b\x86\xb6\xf9\xc3\x21\xf9\x7e\x7a\xf6\xf9\xd8\xb0\x60\x8b\x42\x6a\xd6\x08\x2f\x5a\x9a\x2e\x60\x7a\xf6\x39\x98\xaf\x4d\x81\xd9\x94\xae\x7f\x8a\x9e\x56\x24\x75\x21\x71\xe4\xfb\xe6\x6e\x17\x4f\xf3\xa1\x70\x86\x26\x24\xf1\xa0\x58\x3e\xc8\x5d\x78\x75\x40\xd9\x79\x5a\x97\x0b\xf1\x1d\xa7\x92\x59\x1b\x4a\x11\x95\x94\xa9\x1f\x6c\xc6\x71\xf4\xf6\x96\x56\xe1\xcb\xab\x83\xaf\xfd\xa5\x16\x79\xda\xe0\x50\x5d\xa9\x6f\x7d\xd6\xd5\xf4\x96\x70\xdf\xdd\xb8\xe7\xc8\xf2\xf6\xa2\x4c\x4b\xd8\x6b\xdf\x87\x1d\xcc\x02\xdd\xb1\x50\x4c\x8a\xef\x68\xd2\x9b\x11\x50\xcb\xed\xd0\xd0\xd4\x7b\x77\xdf\x00\x43\xd3\x45\xe8\x5e\x31\x5d\xb1\x7f\xd4\xd8\xb5\x15\x64\xd6\x5a\xe1\x0d\x4d\xf5\x54\x79\x04\x4a\x5f\x34\x73\x61\x49\xdf\x6b\xe0\x5a\x5d\xa1\xb1\x3e\x85\xba\x2e\xf0\x5b\xe8\xcf\x32\xf0\xfd\x56\x9a\xb5\xed\x16\xfc\xf0\xe9\xfa\xc1\x7d\xb8\x7f\x28\x88\xfa\x3a\x6a\xe5\x06\x13\x0c\x75\x96\xbb\x46\x98\x41\x63\xe9\x47\x88\xc7\xc2\x4e\x59\x89\xfd\x9c\xf8\x93\x67\x20\x0c\xda\x03\x92\x98\x63\x6d\xce\xa6\x5b\xea\x78\xe9\x83\xde\x47\x09\x49\x26\xa1\x69\xf6\x04\xcb\x33\x5f\xce\xf0\x9c\x39\xaf\x25\x1c\xc1\xcb\x83\x43\xd8\x83\x83\xfd\xc3\x17\xbd\xcf\xde\x4a\xcd\x37\x03\x68\x6a\x1a\xfc\x03\xdf\x9e\xd4\x0e\x6f\x1a\x5c\x9b\x0a\x03\x6c\xd3\x84\xf5\xd3\x80\xba\x42\xeb\xc4\x8a\x00\x54\x7d\xc6\xf0\xb1\x00\xe1\x7e\x6f\xbb\xd1\x80\x9c\xda\xcd\x15\x23\x72\xab\x15\x39\x1a\xc8\x35\xd9\xc8\xea\x51\xa8\x9c\xd7\xc2\x22\x18\x2c\xf5\x55\x10\x04\x5c\x97\xc4\x31\xde\x9e\x5c\x82\x9a\x74\xc7\xa4\xcb\xba\x80\x2f\x5f\xe9\x3a\x1a\x51\x2a\x35\xbd\x7f\xa3\xe0\xae\xd1\xfc\xe9\xe9\xd2\x4f\x8e\x3f\x9c\xd2\xf7\x87\xe3\x33\xd7\xd5\x2d\x6d\x3f\x02\xbb\x35\x2d\x26\x3d\x61\x30\x04\x36\xa3\xaa\x1f\x14\xfb\xd1\xae\x6f\xd7\x3f\x69\xbe\x99\x2f\x2e\xd6\x06\x99\xef\xc4\x5b\xfa\x67\x25\x9f\x58\xf9\x6b\xc8\x8b\x5d\x5f\x87\x68\xb2\xbf\x58\x63\x83\x18\x5a\xcc\xb8\x0b\xc3\x38\x85\xa7\xff\xfe\xd1\x87\x9f\x12\xb2\x8d\xe4\x85\xd3\x55\x8b\x6a\xa3\xf4\xbe\x2f\x0d\xed\x52\xb0\xba\x1f\x23\xff\x86\xe1\x3b\x18\x03\xbe\xd2\x80\xea\x4a\x18\xad\xfc\x74\xe8\x34\x70\xe6\xf8\x3a\x6c\x67\xc7\x70\xb1\x46\x83\x34\x55\x5e\x23\xac\xd9\xd5\x76\x60\x34\x57\x97\xca\x81\xc9\x6b\x76\x6b\xbb\x8c\xed\x67\x85\x95\xf6\xa6\xf5\x2e\x7e\xf5\xe2\xe1\x48\xeb\x61\xfe\xdb\xdb\xbc\x48\xb1\x82\xbd\xad\xaa\xb4\x17\xbe\xca\xdd\xd1\xac\xaf\x04\x4f\x93\x06\xf9\xda\x8f\xbd\xb6\xae\x42\x19\x4a\x7a\xaf\xfc\x05\xb1\x7a\x23\xc5\x15\xa6\xdb\xe5\xad\x5d\xf7\x93\x57\x6a\x1b\x0f\x64\xbd\x68\x7f\xdc\xc6\xcb\xd6\xbb\xf9\x3f\x01\x00\x00\xff\xff\x38\x97\x59\x2e\xda\x14\x00\x00"),
+			modTime:          mustUnmarshalTextTime("2020-02-08T23:32:11Z"),
+			uncompressedSize: 5926,
+                        compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x58\xdd\x72\xdb\xba\xf1\xbf\x26\x9f\x62\xff\x9c\x7f\xcf\x21\x1d\x45\xb2\xd3\x93\x74\x9a\xd6\x17\x89\x4e\xec\xe4\x34\xb6\x3c\x96\xd3\x9e\x99\x34\x93\x81\xc0\xa5\x04\x0b\x04\x58\x00\x94\xac\x78\xf4\x00\x7d\x90\xbe\x58\x9f\xa4\xb3\x00\x3f\x24\x5b\x49\xda\x4e\x79\x23\x71\xf1\xdb\xc5\x62\x3f\xb1\x1c\x8d\xe0\xc9\xac\x16\x32\x87\x5b\x1b\xc7\x15\xe3\x4b\x36\x47\x30\xb5\x72\xa2\xc4\x38\x16\x65\xa5\x8d\x83\x34\x8e\x92\x86\x36\x12\xca\xa1\x51\x4c\x8e\xec\xc6\x26\x71\x1c\x25\x73\xe1\x16\xf5\x6c\xc8\x75\x39\x9a\xeb\x6a\x81\xe6\xd6\xf6\x7f\x6e\x6d\x12\x67\x71\xcc\xb5\xb2\x0e\xce\x27\x93\x29\x9c\x82\xdd\xd8\x21\xfd\xed\xa8\xaf\xae\xc7\x6f\xe1\x14\x12\x02\x07\xda\x58\x97\x95\x90\x68\x88\xda\xca\x4a\xe2\x78\x34\x82\x82\x2d\x11\x0a\x6d\x00\x8d\xd1\x66\x38\xd7\xb1\xdb\x54\x08\x58\x30\x8e\x60\x9d\xa9\xb9\x83\xfb\x38\xfa\xec\xa9\x47\xfe\x27\xde\x06\x4c\xa0\xf5\x18\xeb\x0c\xbd\x09\x35\x8f\xb7\x71\x5c\xd4\x8a\x43\xea\x1a\x9e\xac\x59\x49\xdb\x3f\xc4\x60\xd0\xd5\x46\x81\x1b\x5a\x67\xe2\xed\x23\x8e\x6a\x39\xaf\x98\x5b\x1c\x62\x49\x92\x6e\x0b\xa1\x84\x4b\x33\x5a\xbb\xb5\x57\xcb\x39\xbc\x3c\x85\x5b\x3b\x3c\x97\x7a\xc6\xe4\xf0\x1c\x5d\x9a\xfc\x7f\xe3\x06\x9b\x64\x81\xf0\x3d\x0b\x67\x24\xab\x15\x31\xf5\x22\x6e\xed\x64\x76\x8b\xdc\x5d\x39\x93\x0c\xc0\xef\x14\x64\x05\x72\x2b\xb9\x72\x26\xc9\x0e\xb2\xbf\x21\xf3\x3e\xe2\xf6\xd4\xef\x31\xbb\x85\xd1\xeb\xeb\x10\x2e\x81\x81\x64\x0c\xdf\x35\x81\x13\x34\x48\x3d\x8a\xd8\x47\x23\x60\x2b\x2d\x72\xc8\x91\xe5\xc0\x75\x8e\x80\x52\x94\x42\x31\x27\xb4\x8a\xa3\x15\x33\x80\xc1\xdd\x71\x84\x70\x0a\x3f\xdc\x6c\x2a\x7c\x65\x2d\x1a\x02\xf8\x1d\xee\xb7\x71\xf4\x19\x4e\x01\x3b\x33\x9f\x4f\xae\x27\x93\x9b\x3d\x5f\x54\x46\x73\xb4\xf6\x80\xc5\x9b\x15\x32\xa4\x28\xa0\xc5\x9d\x7a\xdc\x07\x95\x63\x21\x14\xe6\x24\xa2\xf3\xe7\x28\x89\xa3\xad\x47\xaf\x48\x5e\xc3\x12\xa4\xa1\x5a\xb5\x26\x3a\x9f\x5c\xbd\x7d\x73\xfd\xcb\xf4\x73\x50\x27\xc9\xfe\x00\x2b\xf8\xbf\x03\x72\x47\x23\x38\xf7\x1e\xfd\x65\xfa\xd4\x56\xc8\x45\x21\xda\x33\xc0\x8a\xc9\x1a\xc1\xb1\x25\x5a\xa8\x0c\x72\xcc\x51\x71\x1c\xf6\xda\xac\x86\xd3\x26\x58\xe3\x68\x0b\x28\x2d\xc2\xf7\x15\xfb\xb6\x3e\x87\x24\x7b\x57\x51\xf2\xfe\x8c\x05\xab\xa5\x3b\xd7\x46\x6b\x07\xc2\x82\xd2\x6b\x98\x6b\x85\x03\xe0\x4c\xfd\xe8\xa0\x26\x0d\x1c\x30\x0b\x05\x93\x72\xc6\xf8\x12\x98\xda\x94\xda\x90\xd6\xa3\x11\xdc\x4c\x7e\x9e\xbc\x84\x29\x7a\x3d\x19\xcc\xd0\x39\x34\x60\xb5\xac\xc9\xa3\x5e\x22\x62\x8e\xf9\xb0\x4f\xa0\x51\x6d\xcd\x48\x6a\xce\xe4\x68\xae\xfb\x6c\x7a\x6d\x90\x2d\x2b\x2d\x54\x97\x53\xc3\x9f\x71\x56\xcf\xe7\x68\xd2\xac\x43\x8d\x99\x94\x68\x52\xbb\x14\x15\x08\xe5\x32\x48\x2b\x0e\xb5\x50\xae\x72\x66\x00\x85\x90\xd8\x84\xc9\x00\xa4\x50\x48\x98\x01\xe8\x25\xcc\xb4\x96\x5e\xac\x50\x85\x3e\x10\x37\x6d\x3a\x5c\xe2\x3a\x6d\x0c\x6b\x1d\xe3\xcb\x24\x1b\xd2\x96\x69\x62\x2b\x29\x5c\x32\x80\xe4\xaf\x2a\xc9\x86\xef\x54\x8e\x77\x41\x8b\x27\xf0\x2c\x04\x9b\x97\xfc\x8d\x48\x3b\x1e\x40\x92\x0c\xe8\xa7\x60\xd2\xa2\x77\x43\xc5\x8c\xf3\x61\x4c\xcc\xed\x4e\xf5\x2c\x1c\x21\x19\xec\x92\x05\x6d\x39\x29\x48\x85\xd4\x6b\xe0\xd2\xec\xc9\xc9\xd7\x20\x59\x0b\x79\xa4\xff\x4b\xca\x8d\x5e\x25\xaf\x41\x73\x9e\xe3\xac\x0b\x92\xfd\x85\x93\x46\xd8\x00\x9c\xa9\xf1\x81\x33\x6c\xe7\x8d\x01\x54\x1c\x3e\x7e\x6a\xdc\x91\x11\x69\xa7\x72\x1e\x13\xdf\x68\xd4\x72\x9d\x19\x56\xa2\x0d\x31\xe7\x40\x94\x95\xc4\x12\x95\xc3\xdc\xf7\x84\xd0\x4a\x4e\x6f\xed\x30\xee\xa2\xec\x5d\x8b\xa1\x58\xab\xb4\xb5\x62\x26\x71\xb8\xa7\x4a\x10\x9a\xf2\xf0\xb6\xab\xcb\x51\xb3\xdf\x3d\x34\xea\xfc\x10\x08\xf7\x5b\xd8\xc6\xa1\xab\x34\x88\xd0\x56\xee\xbb\x46\xc2\x45\xcb\x9c\xc1\x25\xde\x51\x78\xa6\x05\xbd\x07\x86\x01\x50\x36\xb4\x01\xd6\x4a\xdf\x93\xb9\xd3\xa9\xae\xc6\x10\x9e\x46\xb1\x38\x3a\xa3\x4d\xe8\x39\xa2\x7f\xe1\xdd\xe7\x4e\xd3\xd0\xa2\x33\x0a\x6a\x7a\x5a\xc2\x7b\x0a\x6c\x7a\x84\x72\x71\xf4\x46\x39\xb3\xd9\x95\xd8\xd5\xcd\xb1\x4f\xa4\xee\x55\xe3\x5d\xdf\xaf\xf6\xdb\x14\xaf\x0d\x95\x80\xda\x09\x85\x49\x16\x8a\x3f\xa1\x93\xe0\xf0\xbd\xce\x10\xc2\x29\xb4\x86\x64\x00\x4a\xc8\x6c\xa7\x54\x5f\xbc\xfa\xf5\xea\x7a\x32\x9e\xa6\x2a\xa4\xe7\x7e\x08\x9c\xec\x68\x63\xf9\x02\xf3\xa0\x0e\xa7\x0c\x28\xd9\x12\x53\xbe\x60\xaa\x73\xc0\xa1\x6d\x2d\xba\x1b\x51\xa2\xae\xdd\xc1\x56\x44\xb2\x49\x26\x70\xa9\x2d\xa6\x3c\x83\x6d\x36\x80\xe3\x2c\x8e\xfe\xf8\x94\x77\x9b\x5f\xd6\xe5\xf8\xea\x43\xfa\x75\xed\x2e\xeb\xb2\xb3\xc7\x23\xd8\x43\xe3\x39\xed\x98\xec\xe0\xb6\x4d\xbc\xb8\x0d\x81\x0b\x2c\xa7\x8e\x39\xbb\x13\x05\xd4\x23\x50\xa1\x61\x12\xac\x63\x4e\x58\x27\xb8\x1d\xc6\xd1\x2b\x29\x35\xef\xe3\xe3\xc5\x4f\x30\x1a\xc1\x6c\xe3\xd0\x02\xa3\x25\x46\xe9\xc1\x54\x0e\xd6\x09\x29\x41\x28\xaa\xcf\x71\x74\x43\x1a\x04\xde\xaf\xb3\xa5\xb8\x42\x45\x99\x53\x18\xc4\x3c\x8b\xa3\xe9\xc6\x02\x1c\xde\x4c\xcf\x1c\xf3\xe5\xab\x30\xba\xa4\x46\xe1\xb0\x84\xd4\xd6\x25\xe8\x02\x7e\xbd\xbb\x23\xd6\x19\x4a\xbd\xce\xe2\xe8\xbd\xd6\xcb\xba\xb2\xfb\x62\x54\x5d\xce\xd0\x10\xda\x57\x74\x34\x20\x03\x2c\x8e\x2e\xbc\x4a\x5f\xc5\x97\x61\x39\x8e\xce\x0c\xa2\x7d\xa8\x5e\x8f\xa3\x53\xd8\xd8\x9b\xf2\x82\x09\xd5\x1e\x94\x12\x67\x81\xac\xda\xb7\xeb\x5b\x64\x55\x67\xdb\xff\xc4\xb2\xc4\xd8\xd9\xe9\xdf\xb1\x52\x60\x79\x97\x37\x29\xfb\x90\x45\x28\x10\xb4\x66\x2b\xa6\x6c\x83\x55\xd4\x63\x0f\x63\x95\x56\x4f\x3b\x7c\x80\x5f\xa3\x44\x66\x31\x7f\x04\x37\xed\x82\xd3\xe0\x16\x08\x93\x69\x60\x08\x99\x61\x77\xe5\xfb\x88\xdd\xb1\x65\x6f\x01\x1d\xc0\xc1\xae\xef\xf5\xfa\xa9\xc4\x15\x4a\x28\xc4\x1d\xe6\x4f\xad\xf8\xd2\x96\xb2\xda\x60\xcb\xa5\xcd\xbe\xad\x47\xa3\x28\x1c\x49\xd8\x46\xb3\x9a\xb4\x52\x7a\x1d\x16\xc9\x9c\xdd\xd2\x21\x13\x0e\xe3\x68\x4a\xad\xb7\x31\xcc\xc3\x73\x7a\x69\xb3\x0d\xf8\xf6\xdc\x2b\xd1\x30\x35\xce\x0a\x4c\x71\x74\x31\xad\x98\x7a\x24\xa8\x24\x73\xf6\x27\xb1\x0d\xee\x21\xef\x98\xf1\x05\x06\xe6\x1d\x5e\x4e\xd4\x7d\x66\x0f\x0c\xdc\x2d\xf3\xeb\x9a\x2f\xdf\x32\xbb\x20\x6a\xcf\x5c\x19\x5d\x08\x49\x97\xd8\x59\xcd\x97\xe8\x60\xc1\xec\x02\x1c\x9b\x49\x8c\xa3\xf3\x71\x9f\x91\x3d\xcb\xf9\x18\x4a\x74\x2c\x67\x8e\xc5\xd1\xc4\x2d\xd0\xec\xa9\x49\x10\x4d\xd4\x36\x4b\xfb\x3c\x68\xbc\x78\xce\xcc\x8c\x26\x41\xae\xa5\x44\xfe\xc8\x5d\xd4\xd1\xce\xc7\x8f\x0b\x81\xc2\x3b\xd7\xf2\x50\x52\xad\x29\x2d\x16\xac\xaa\x50\xc1\x7a\x81\x0a\xfa\x9c\xfa\xe7\xdf\xff\x01\x6e\x21\x2c\xb0\x52\xd7\xd4\x92\xde\x33\x7b\x50\x26\xaa\x1c\x68\x94\xa0\x98\x93\xcc\xee\xc9\x4f\x15\x53\xda\x22\xd7\x2a\xb7\x60\x85\xe2\x08\x27\xbf\xff\x1d\x55\xee\x2b\x56\x5b\xf4\x25\xee\xd2\xf6\x06\xf6\xd4\xcb\xd6\x5e\x1f\x9f\x3d\x7f\xf1\xa9\xdf\x88\x0b\xc3\x6b\xc9\x0c\xcc\xea\xa2\x08\x31\x4e\xb7\x6d\xe5\xc8\x9c\x15\x71\x42\x5e\x9b\x60\x25\xea\xdf\xd6\xb5\xeb\xcc\xc1\xc7\x94\xca\xff\xf8\xc9\xb3\xe7\xcf\xb3\xdf\x90\xdc\x66\xb3\x37\x2a\xff\x6f\x37\x6b\x0f\x6e\xe3\xc8\xcb\x86\x5d\xdb\xfc\xf6\x19\xf9\x7e\x7c\xf5\xe1\xcc\xb0\x60\x8b\x42\x6a\xd6\x08\x2f\x5a\x9a\x2e\x60\x7c\xf5\x21\x98\xaf\x4d\x81\xf3\x31\xb5\x7f\x8a\x9e\x56\x24\xdd\x42\xe2\xc8\xdf\x9b\xbb\x5d\x3c\xcd\x87\xc2\x15\x9a\x90\xc4\x3b\xc5\xf2\x41\xee\xc2\x8b\x13\xca\xce\xcb\xba\x9c\x8a\x2f\x38\x96\xcc\xda\x50\x8a\xa8\xa4\x8c\xfd\x4c\x37\x8c\xa3\xd7\x1b\x5a\x85\x8f\x2f\x4e\x3e\xf5\x4d\x2d\xf2\xb4\x9d\x43\x75\xa5\xbe\xf5\x59\x57\xd3\x5b\xc2\xb6\xeb\xb8\xd7\xc8\xf2\xb6\x51\xa6\x25\x1c\xb5\xff\x77\x6f\x30\x53\x74\x67\x42\x31\x29\xbe\xa0\x49\xef\x06\x40\x57\x6e\x87\xa6\x60\x1c\xef\xb7\x0d\x30\x5c\xba\x08\xdd\x2b\xa6\x2b\xf6\xb7\x1a\xbb\x6b\x05\x99\xb5\x56\x78\x57\x69\xe3\x6f\x9b\x02\xa5\x2f\x9a\xb9\xb0\xa4\xef\x1a\xb8\x56\x2b\x34\xd6\xa7\x50\x77\x0b\xfc\x1c\xee\x67\x19\xf8\xfb\x56\x9a\xb5\xd7\x2d\xf8\xe6\xd3\xdd\x07\x8f\x61\xfb\x50\x10\xdd\xeb\xe8\x2a\xb7\x33\xc1\xd0\xcd\xf2\xd0\x08\xb3\x73\xb1\xf4\x23\xc4\x63\x61\x97\xac\xc4\x7e\x44\xfe\xce\xb3\x23\x0c\xda\x03\x92\x98\x33\x6d\xae\xc6\x7b\xea\x78\xe9\x3b\x77\x1f\x25\x24\x99\x84\x06\xf9\x0b\x2c\xaf\x7c\x39\xc3\x6b\xe6\xbc\x96\x70\x0a\xcf\x4f\x9e\xc1\x11\x9c\x1c\x3f\xfb\xa9\xf7\xd9\x6b\xa9\xf9\x72\x07\x9a\x9a\x06\xff\xc0\xb7\x17\xb5\xc3\xbb\x06\xd7\xa6\xc2\x0e\xb6\xb9\x84\xf5\xd3\x80\x5a\xa1\x75\x62\x4e\x00\xaa\x3e\x43\x78\x57\x80\x70\x3f\xda\x6e\x34\x20\xa7\x76\x73\xc5\x80\xdc\x6a\x45\x8e\x06\x72\x4d\x36\xb2\x7a\x10\x2a\xe7\x5a\x58\x04\x83\xa5\x5e\x05\x41\xc0\x75\x49\x1c\xc3\xfd\xc9\x25\xa8\x49\x3d\x26\x9d\xd5\x05\x7c\xfc\x44\xed\x68\x40\xa9\xd4\xdc\xfd\x1b\x05\x0f\x7d\x95\xf8\xfa\x74\xe9\x27\xc7\x6f\x7e\xa0\x38\xf6\x83\x62\xf3\xc2\x75\xb5\xa1\xed\x07\x60\xf7\xa6\xc5\xa4\x27\xec\x0c\x81\xcd\xa8\xea\x07\xc5\x7e\xb4\xeb\xaf\xeb\xef\x35\x5f\x4e\xa6\x37\x0b\x83\xcc\xdf\xc4\x5b\xfa\x07\x25\xbf\xb2\xf2\xe7\x90\x17\x87\x3e\x8c\xd9\x8d\x1d\xde\x2c\xb0\x41\xec\x5a\xcc\xb8\x1b\xc3\x38\x85\xa7\xff\xf4\xd3\x87\x9f\x12\xb2\x8d\xe4\xa9\xd3\x55\x8b\x6a\xa3\x74\xdb\x97\x86\x76\x29\x58\xdd\x8f\x91\x7f\xc1\xf0\x05\x91\x01\x9f\x6b\x40\xb5\x12\x46\x2b\x3f\x1d\x3a\x0d\x9c\x39\xbe\x08\xdb\xd9\x21\xdc\x2c\xd0\x20\x4d\x95\x6b\x84\x05\x5b\xed\x07\x46\xd3\xba\x54\x0e\x4c\xae\xd9\xc6\x76\x19\xdb\xcf\x0a\x73\xed\x4d\xeb\x5d\xfc\xe2\xa7\x87\x23\xad\x87\xf9\xaf\x96\x93\x22\xc5\x0a\x8e\xf6\xaa\xd2\x51\xf8\x9e\x79\x4f\xb3\xbe\x12\x3c\x4d\x1a\xe4\x4b\x3f\xf6\xda\xba\x0a\x65\x28\xe9\xbd\xf2\x27\xc4\xea\x95\x14\x2b\x4c\xf7\xcb\x5b\xbb\xee\x27\xaf\xd4\x36\x1e\xc8\x7a\xd1\xfe\xb8\x8d\x97\x6d\x70\x33\x65\xcb\x02\x2d\x02\x33\x7d\xdb\xf0\xe8\xb5\x61\xd5\x10\x2e\xff\x07\xa3\xf7\x1c\x5d\x98\xb7\x2b\x7e\xa0\x2c\x3e\xae\x80\x85\x50\xb9\x9f\xd3\x76\x0b\x0d\x11\xde\xa9\x42\xf7\xf8\x96\xe2\x07\xf4\xc0\x58\x2b\xae\xa8\xce\x15\xdd\xe2\x4e\xc5\x7b\x50\xd4\x7c\x23\xe8\xa4\x76\x33\xfd\xbf\x02\x00\x00\xff\xff\x81\xb9\x90\xc5\x26\x17\x00\x00"),
 		},
 		"/src/strings": &vfsgen۰DirInfo{
 			name:    "strings",
Index: golang-github-gopherjs-gopherjs.dev/compiler/natives/src/runtime/runtime.go
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/compiler/natives/src/runtime/runtime.go	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/compiler/natives/src/runtime/runtime.go	2020-04-08 10:09:50.364655482 +0200
@@ -39,9 +39,11 @@
 	if process == js.Undefined {
 		return "/"
 	}
-	goroot := process.Get("env").Get("GOROOT")
-	if goroot != js.Undefined {
-		return goroot.String()
+	if v := process.Get("env").Get("GOPHERJS_GOROOT"); v != js.Undefined {
+		// GopherJS-specific GOROOT value takes precedence.
+		return v.String()
+	} else if v := process.Get("env").Get("GOROOT"); v != js.Undefined {
+		return v.String()
 	}
 	return sys.DefaultGoroot
 }
Index: golang-github-gopherjs-gopherjs.dev/compiler/version_check.go
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/compiler/version_check.go	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/compiler/version_check.go	2020-04-08 10:46:02.834265195 +0200
@@ -1,9 +1,25 @@
-// +build !go1.10
-// +build go1.9
-
 package compiler
 
-const ___GOPHERJS_REQUIRES_GO_VERSION_1_9___ = true
+import (
+       "bytes"
+       "fmt"
+       "io/ioutil"
+       "path/filepath"
+)
 
 // Version is the GopherJS compiler version string.
-const Version = "1.9-1"
+const Version = "1.12-2"
+
+// CheckGoVersion checks the version of the Go distribution
+// at goroot, and reports an error if it's not compatible
+// with this version of the GopherJS compiler.
+func CheckGoVersion(goroot string) error {
+       v, err := ioutil.ReadFile(filepath.Join(goroot, "VERSION"))
+       if err != nil {
+               return fmt.Errorf("GopherJS %s requires a Go 1.12.x distribution, but failed to read its VERSION file: %v", Version, err)
+       }
+       if !bytes.HasPrefix(v, []byte("go1.12")) { // TODO(dmitshur): Change this before Go 1.120 comes out.
+               return fmt.Errorf("GopherJS %s requires a Go 1.12.x distribution, but found version %s", Version, v)
+       }
+       return nil
+}
Index: golang-github-gopherjs-gopherjs.dev/tests/run.go
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/tests/run.go	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/tests/run.go	2020-04-08 10:09:50.364655482 +0200
@@ -36,6 +36,8 @@
 	"strings"
 	"time"
 	"unicode"
+
+	gbuild "github.com/gopherjs/gopherjs/build"
 )
 
 // -----------------------------------------------------------------------------
@@ -159,7 +161,7 @@
 	flag.Parse()
 
 	// GOPHERJS.
-	err := os.Chdir(filepath.Join(runtime.GOROOT(), "test"))
+	err := os.Chdir(filepath.Join(gbuild.DefaultGOROOT, "test"))
 	if err != nil {
 		log.Fatalln(err)
 	}
@@ -284,14 +286,6 @@
 	}
 }
 
-func toolPath(name string) string {
-	p := filepath.Join(os.Getenv("GOROOT"), "bin", "tool", name)
-	if _, err := os.Stat(p); err != nil {
-		log.Fatalf("didn't find binary at %s", p)
-	}
-	return p
-}
-
 func shardMatch(name string) bool {
 	if *shards == 0 {
 		return true
Index: golang-github-gopherjs-gopherjs.dev/tool.go
===================================================================
--- golang-github-gopherjs-gopherjs.dev.orig/tool.go	2020-04-08 10:09:50.372655810 +0200
+++ golang-github-gopherjs-gopherjs.dev/tool.go	2020-04-08 10:09:50.368655646 +0200
@@ -93,9 +93,13 @@
 	cmdBuild.Run = func(cmd *cobra.Command, args []string) {
 		options.BuildTags = strings.Fields(tags)
 		for {
-			s := gbuild.NewSession(options)
+			s, err := gbuild.NewSession(options)
+			if err != nil {
+				options.PrintError("%s\n", err)
+				os.Exit(1)
+			}
 
-			err := func() error {
+			err = func() error {
 				// Handle "gopherjs build [files]" ad-hoc package mode.
 				if len(args) > 0 && (strings.HasSuffix(args[0], ".go") || strings.HasSuffix(args[0], ".inc.js")) {
 					for _, arg := range args {
@@ -174,9 +178,13 @@
 	cmdInstall.Run = func(cmd *cobra.Command, args []string) {
 		options.BuildTags = strings.Fields(tags)
 		for {
-			s := gbuild.NewSession(options)
+			s, err := gbuild.NewSession(options)
+			if err != nil {
+				options.PrintError("%s\n", err)
+				os.Exit(1)
+			}
 
-			err := func() error {
+			err = func() error {
 				// Expand import path patterns.
 				patternContext := gbuild.NewBuildContext("", options.BuildTags)
 				pkgs := (&gotool.Context{BuildContext: *patternContext}).ImportPaths(args)
@@ -275,7 +283,10 @@
 				os.Remove(tempfile.Name())
 				os.Remove(tempfile.Name() + ".map")
 			}()
-			s := gbuild.NewSession(options)
+			s, err := gbuild.NewSession(options)
+			if err != nil {
+				return err
+			}
 			if err := s.BuildFiles(args[:lastSourceArg], tempfile.Name(), currentDirectory); err != nil {
 				return err
 			}
@@ -324,7 +335,10 @@
 					fmt.Printf("?   \t%s\t[no test files]\n", pkg.ImportPath)
 					continue
 				}
-				s := gbuild.NewSession(options)
+				s, err := gbuild.NewSession(options)
+				if err != nil {
+					return err
+				}
 
 				tests := &testFuncs{Package: pkg.Package}
 				collectTests := func(testPkg *gbuild.PackageData, testPkgName string, needVar *bool) error {
@@ -478,7 +492,7 @@
 	cmdServe.Flags().StringVarP(&addr, "http", "", ":8080", "HTTP bind address to serve")
 	cmdServe.Run = func(cmd *cobra.Command, args []string) {
 		options.BuildTags = strings.Fields(tags)
-		dirs := append(filepath.SplitList(build.Default.GOPATH), build.Default.GOROOT)
+		dirs := append(filepath.SplitList(build.Default.GOPATH), gbuild.DefaultGOROOT)
 		var root string
 
 		if len(args) > 1 {
@@ -490,6 +504,13 @@
 			root = args[0]
 		}
 
+		// Create a new session eagerly to check if it fails, and report the error right away.
+		// Otherwise users will see it only after trying to serve a package, which is a bad experience.
+		_, err := gbuild.NewSession(options)
+		if err != nil {
+			options.PrintError("%s\n", err)
+			os.Exit(1)
+		}
 		sourceFiles := http.FileServer(serveCommandFileSystem{
 			serveRoot:  root,
 			options:    options,
@@ -570,8 +591,13 @@
 	isIndex := file == "index.html"
 
 	if isPkg || isMap || isIndex {
+		// Create a new session to pick up changes to source code on disk.
+		// TODO(dmitshur): might be possible to get a single session to detect changes to source code on disk
+		s, err := gbuild.NewSession(fs.options)
+		if err != nil {
+			return nil, err
+		}
 		// If we're going to be serving our special files, make sure there's a Go command in this folder.
-		s := gbuild.NewSession(fs.options)
 		pkg, err := gbuild.Import(path.Dir(name), 0, s.InstallSuffix(), fs.options.BuildTags)
 		if err != nil || pkg.Name != "main" {
 			isPkg = false
