Skip to content

playground: regenerate with GopherJS 1.12-2 and Go 1.12.13 #72

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

Merged
merged 4 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
playground: add support for syscall/js package
Also modify the default "hello world" snippet to use it,
since it's a more general API.

Modernize update.sh slightly to handle variability in
environments better.

Updates #69
  • Loading branch information
dmitshur committed Dec 1, 2019
commit 86419bc023cdd228026f789ff5ea50fb6935f88c
2 changes: 1 addition & 1 deletion playground/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func main() {
})
}()
} else {
scope.Set("code", "package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/gopherjs/gopherjs/js\"\n)\n\nfunc main() {\n\tfmt.Println(\"Hello, playground\")\n\tjs.Global.Call(\"alert\", \"Hello, JavaScript\")\n\tprintln(\"Hello, JS console\")\n}\n")
scope.Set("code", "package main\n\nimport (\n\t\"fmt\"\n\t\"syscall/js\"\n)\n\nfunc main() {\n\tfmt.Println(\"Hello, playground\")\n\tjs.Global().Call(\"alert\", \"Hello, JavaScript\")\n\tprintln(\"Hello, JS console\")\n}\n")
close(codeReady)
}
scope.Set("imports", true)
Expand Down
16 changes: 15 additions & 1 deletion playground/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ cleanup() {

trap cleanup EXIT HUP INT TERM

# This script relies on GOPATH mode. The GOPATH workspace
# must contain both github.com/gopherjs/gopherjs and
# github.com/gopherjs/gopherjs.github.io repositories.
export GO111MODULE=off

# TODO: This script relies on $(go env GOROOT) not being user-writable.
# It can be improved to work even when $(go env GOROOT) is user-writable
# by making a GOROOT copy here, immediately chmod-ing it to be non-user-writable,
# and later on chmod-ing it be user-writable again.
# See https://github.com/gopherjs/gopherjs.github.io/issues/69.

go install github.com/gopherjs/gopherjs/...

go generate github.com/gopherjs/gopherjs.github.io/playground/internal/imports
Expand All @@ -33,10 +44,12 @@ mkdir -p pkg/github.com/gopherjs/gopherjs
cp "$GOPATH"/pkg/*_js_min/github.com/gopherjs/gopherjs/js.a pkg/github.com/gopherjs/gopherjs/js.a
cp "$GOPATH"/pkg/*_js_min/github.com/gopherjs/gopherjs/nosync.a pkg/github.com/gopherjs/gopherjs/nosync.a

# Make a copy of GOROOT that is user-writeable,
# Make a copy of GOROOT that is user-writable,
# use it to build and copy out standard library packages.
echo "copying GOROOT from $(go env GOROOT) to $tmp/goroot"
cp -a "$(go env GOROOT)" "$tmp/goroot"
export GOROOT="$tmp/goroot"
unset GOPHERJS_GOROOT # force $GOROOT to be used
gopherjs install -m \
archive/tar \
archive/zip \
Expand Down Expand Up @@ -125,6 +138,7 @@ gopherjs install -m \
strconv \
strings \
sync/atomic \
syscall/js \
testing \
testing/iotest \
testing/quick \
Expand Down