Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83a7ce4

Browse files
committed
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 inenvironments better.Updates#69
1 parent9d23d21 commit83a7ce4

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎playground/playground.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func main() {
5454
})
5555
}()
5656
}else {
57-
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")
57+
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")
5858
close(codeReady)
5959
}
6060
scope.Set("imports",true)

‎playground/update.sh‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ cleanup() {
1010

1111
trap cleanup EXIT HUP INT TERM
1212

13+
# This script relies on GOPATH mode. The GOPATH workspace
14+
# must contain both github.com/gopherjs/gopherjs and
15+
# github.com/gopherjs/gopherjs.github.io repositories.
16+
export GO111MODULE=off
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+
1324
go install github.com/gopherjs/gopherjs/...
1425

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

36-
# Make a copy of GOROOT that is user-writeable,
47+
# Make a copy of GOROOT that is user-writable,
3748
# use it to build and copy out standard library packages.
49+
echo"copying GOROOT from$(go env GOROOT) to$tmp/goroot"
3850
cp -a"$(go env GOROOT)""$tmp/goroot"
3951
export GOROOT="$tmp/goroot"
52+
unset GOPHERJS_GOROOT# force $GOROOT to be used
4053
gopherjs install -m \
4154
archive/tar \
4255
archive/zip \
@@ -125,6 +138,7 @@ gopherjs install -m \
125138
strconv \
126139
strings \
127140
sync/atomic \
141+
syscall/js \
128142
testing \
129143
testing/iotest \
130144
testing/quick \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp