@@ -15,41 +15,43 @@ trap cleanup EXIT HUP INT TERM
15
15
# github.com/gopherjs/gopherjs.github.io repositories.
16
16
export GO111MODULE=off
17
17
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
-
24
18
go install github.com/gopherjs/gopherjs/...
25
19
26
20
go generate github.com/gopherjs/gopherjs.github.io/playground/internal/imports
27
21
28
- # Build playground itself.
29
- gopherjs build -m
30
-
31
22
# The GOPATH workspace where the GopherJS project is.
32
23
gopherjsgopath=$( go list -f ' {{.Root}}' github.com/gopherjs/gopherjs)
33
24
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
35
36
36
37
# Use an empty GOPATH workspace with just gopherjs,
37
38
# so that all the standard library packages get written to GOROOT/pkg.
38
39
export GOPATH=" $tmp /gopath"
39
40
mkdir -p " $GOPATH " /src/github.com/gopherjs/gopherjs
40
41
cp -a " $gopherjsgopath " /src/github.com/gopherjs/gopherjs/* " $GOPATH " /src/github.com/gopherjs/gopherjs
41
42
43
+ rm -rf pkg/
44
+
42
45
gopherjs install -m github.com/gopherjs/gopherjs/js github.com/gopherjs/gopherjs/nosync
43
46
mkdir -p pkg/github.com/gopherjs/gopherjs
44
47
cp " $GOPATH " /pkg/* _js_min/github.com/gopherjs/gopherjs/js.a pkg/github.com/gopherjs/gopherjs/js.a
45
48
cp " $GOPATH " /pkg/* _js_min/github.com/gopherjs/gopherjs/nosync.a pkg/github.com/gopherjs/gopherjs/nosync.a
46
49
47
- # Make a copy of GOROOT that is user-writable,
50
+ # Make our GOROOT copy user-writable now, then
48
51
# 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
+
53
55
gopherjs install -m \
54
56
archive/tar \
55
57
archive/zip \
0 commit comments