@@ -15,41 +15,43 @@ trap cleanup EXIT HUP INT TERM
1515# github.com/gopherjs/gopherjs.github.io repositories.
1616export GO111MODULE=off
1717
18- # TODO: This script relies on $(go env GOROOT) not being user-writable.
19- # It can be improved to work even when $(go env GOROOT) is user-writable
20- # by making a GOROOT copy here, immediately chmod-ing it to be non-user-writable,
21- # and later on chmod-ing it be user-writable again.
22- # See https://github.com/gopherjs/gopherjs.github.io/issues/69.
23-
2418go install github.com/gopherjs/gopherjs/...
2519
2620go generate github.com/gopherjs/gopherjs.github.io/playground/internal/imports
2721
28- # Build playground itself.
29- gopherjs build -m
30-
3122# The GOPATH workspace where the GopherJS project is.
3223gopherjsgopath=$( go list -f ' {{.Root}}' github.com/gopherjs/gopherjs)
3324
34- rm -rf pkg/
25+ # Make a copy of GOROOT that is non-user-writable,
26+ # to prevent any GopherJS packages being written to it for now.
27+ echo " copying GOROOT from $( go env GOROOT) to $tmp /goroot"
28+ cp -a " $( go env GOROOT) " " $tmp /goroot"
29+ echo " making our copy of GOROOT non-user-writable for now"
30+ chmod -R -w " $tmp /goroot"
31+ export GOROOT=" $tmp /goroot"
32+ unset GOPHERJS_GOROOT # force $GOROOT to be used
33+
34+ # Build playground itself.
35+ gopherjs build -m
3536
3637# Use an empty GOPATH workspace with just gopherjs,
3738# so that all the standard library packages get written to GOROOT/pkg.
3839export GOPATH=" $tmp /gopath"
3940mkdir -p " $GOPATH " /src/github.com/gopherjs/gopherjs
4041cp -a " $gopherjsgopath " /src/github.com/gopherjs/gopherjs/* " $GOPATH " /src/github.com/gopherjs/gopherjs
4142
43+ rm -rf pkg/
44+
4245gopherjs install -m github.com/gopherjs/gopherjs/js github.com/gopherjs/gopherjs/nosync
4346mkdir -p pkg/github.com/gopherjs/gopherjs
4447cp " $GOPATH " /pkg/* _js_min/github.com/gopherjs/gopherjs/js.a pkg/github.com/gopherjs/gopherjs/js.a
4548cp " $GOPATH " /pkg/* _js_min/github.com/gopherjs/gopherjs/nosync.a pkg/github.com/gopherjs/gopherjs/nosync.a
4649
47- # Make a copy of GOROOT that is user-writable,
50+ # Make our GOROOT copy user-writable now, then
4851# use it to build and copy out standard library packages.
49- echo " copying GOROOT from $( go env GOROOT) to $tmp /goroot"
50- cp -a " $( go env GOROOT) " " $tmp /goroot"
51- export GOROOT=" $tmp /goroot"
52- unset GOPHERJS_GOROOT # force $GOROOT to be used
52+ echo " making our copy of GOROOT user-writable again"
53+ chmod -R u+w " $tmp /goroot"
54+
5355gopherjs install -m \
5456 archive/tar \
5557 archive/zip \
0 commit comments