Closed dmitshur closed 7 years ago
I'm investigating this right now.
Everything seems to work okay, except that something causes unsafe
package to get loaded, and that fails, because it's not one of the installed packages:
I tried adding it to that list, and that fixes the problem:
diff --git a/playground/update.sh b/playground/update.sh
index 5d62c70..578a5fa 100755
--- a/playground/update.sh
+++ b/playground/update.sh
@@ -134,7 +135,8 @@ gopherjs install -m \
time \
unicode \
unicode/utf16 \
- unicode/utf8
+ unicode/utf8 \
+ unsafe
cp -a "$GOROOT"/pkg/*_js_min/* pkg/
cp -a "$GOROOT"/pkg/*_amd64_js_min/* pkg/
However, I want to look around first to see if there's a better fix, and whether this is indicative of a problem somewhere in GopherJS 1.9-1.
The "unsafe" package is special-cased here:
I want to see what changed related to that causing it to be included as part of a build, where previously it wasn't.
This is the generated code for the unsafe
package:
$packages["unsafe"] = (function() {
var $pkg = {}, $init;
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
It's basically empty (aside from bookkeeping related to goroutines and blocking calls). It contains an empty init
function, and that's the only thing that gets called by other packages.
Figured it out. It's due to an API change in go/types
package (https://github.com/golang/go/issues/21622).
"go/types".Package.Imports
used to exclude package unsafe
in Go 1.8, but no longer does in 1.9.
Compare https://gotools.org/go/types?rev=go1.8.3#package.go-L54-L55 vs https://gotools.org/go/types?rev=go1.9#package.go-L50-L51.
I might need to make additional changes, so I've undone the deploy of 8bcc3f3a576ba326bbd26a1d27f5de696b8cf9dd for now.
This should be done with GopherJS version 1.9-1.