Skip to content

Commit 062fe8d

Browse files
committed
misc/wasm: move wasm runtime files to lib/wasm
1 parent d363534 commit 062fe8d

File tree

56 files changed

+79
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+79
-13
lines changed

doc/next/7-ports.md

Lines changed: 3 additions & 0 deletions
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/cmd/distpack/test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ var modRules = []testRule{
7373
{name: "golang.org/toolchain@*/src/cmd/go/main.go"},
7474
{name: "golang.org/toolchain@*/src/bytes/bytes.go"},
7575

76+
{name: "golang.org/toolchain@*/lib/wasm/go_js_wasm_exec"},
77+
{name: "golang.org/toolchain@*/lib/wasm/go_wasip1_wasm_exec"},
78+
{name: "golang.org/toolchain@*/lib/wasm/wasm_exec.js"},
79+
{name: "golang.org/toolchain@*/lib/wasm/wasm_exec_node.js"},
80+
7681
{name: "**/.DS_Store", exclude: true},
7782
{name: "golang.org/toolchain@*/.git", exclude: true},
7883
{name: "golang.org/toolchain@*/.gitattributes", exclude: true},

src/cmd/go/internal/toolchain/select.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,20 @@ func Exec(gotoolchain string) {
353353
base.Fatalf("download %s: %v", gotoolchain, err)
354354
}
355355
if info.Mode()&0111 == 0 {
356-
// allowExec sets the exec permission bits on all files found in dir.
357-
allowExec := func(dir string) {
356+
// allowExec sets the exec permission bits on all files found in dir if pattern is the empty string,
357+
// or only those files that match the pattern if it's non-empty.
358+
allowExec := func(dir, pattern string) {
358359
err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
359360
if err != nil {
360361
return err
361362
}
362363
if !d.IsDir() {
364+
if pattern != "" {
365+
if matched, _ := filepath.Match(pattern, d.Name()); !matched {
366+
// Skip file.
367+
return nil
368+
}
369+
}
363370
info, err := os.Stat(path)
364371
if err != nil {
365372
return err
@@ -380,12 +387,13 @@ func Exec(gotoolchain string) {
380387
// then the check of bin/go above might succeed, the other go command
381388
// would skip its own mode-setting, and then the go command might
382389
// try to run a tool before we get to setting the bits on pkg/tool.
383-
// Setting pkg/tool before bin/go avoids that ordering problem.
390+
// Setting pkg/tool and lib before bin/go avoids that ordering problem.
384391
// The only other tool the go command invokes is gofmt,
385392
// so we set that one explicitly before handling bin (which will include bin/go).
386-
allowExec(filepath.Join(dir, "pkg/tool"))
387-
allowExec(filepath.Join(dir, "bin/gofmt"))
388-
allowExec(filepath.Join(dir, "bin"))
393+
allowExec(filepath.Join(dir, "pkg/tool"), "")
394+
allowExec(filepath.Join(dir, "lib"), "go_*_*_exec")
395+
allowExec(filepath.Join(dir, "bin/gofmt"), "")
396+
allowExec(filepath.Join(dir, "bin"), "")
389397
}
390398
}
391399

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.aix-ppc64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.android-386.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.android-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.android-arm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.android-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.darwin-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.darwin-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.dragonfly-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.freebsd-386.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.freebsd-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.freebsd-arm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.freebsd-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.freebsd-riscv64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.illumos-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.ios-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.ios-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.js-wasm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-386.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-arm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-loong64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-mips64x.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-mipsx.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-ppc64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-ppc64le.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-riscv64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.linux-s390x.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.netbsd-386.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.netbsd-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.netbsd-arm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.netbsd-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.openbsd-386.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.openbsd-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.openbsd-arm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.openbsd-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.openbsd-mips64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.openbsd-ppc64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.openbsd-riscv64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.plan9-386.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.plan9-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.plan9-arm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.solaris-amd64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ echo go1.999testmod here!
1212
-- bin/gofmt --
1313
echo i am unused
1414
-- pkg/tool/fake --
15+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.windows-386.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ module golang.org/toolchain
88
module golang.org/toolchain
99
-- bin/go.bat --
1010
@echo go1.999testmod here!
11+
-- pkg/tool/fake --
12+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.windows-amd64.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ module golang.org/toolchain
88
module golang.org/toolchain
99
-- bin/go.bat --
1010
@echo go1.999testmod here!
11+
-- pkg/tool/fake --
12+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.windows-arm.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ module golang.org/toolchain
88
module golang.org/toolchain
99
-- bin/go.bat --
1010
@echo go1.999testmod here!
11+
-- pkg/tool/fake --
12+
-- lib/wasm/go_js_wasm_exec --

src/cmd/go/testdata/mod/golang.org_toolchain_v0.0.1-go1.999testmod.windows-arm64.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ module golang.org/toolchain
88
module golang.org/toolchain
99
-- bin/go.bat --
1010
@echo go1.999testmod here!
11+
-- lib/wasm/go_js_wasm_exec --

src/syscall/js/js_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// To run these tests:
88
//
99
// - Install Node
10-
// - Add /path/to/go/misc/wasm to your $PATH (so that "go test" can find
10+
// - Add /path/to/go/lib/wasm to your $PATH (so that "go test" can find
1111
// "go_js_wasm_exec").
1212
// - GOOS=js GOARCH=wasm go test
1313
//
@@ -587,13 +587,13 @@ func TestGarbageCollection(t *testing.T) {
587587
// Note: All JavaScript functions return a JavaScript array, which will cause
588588
// one allocation to be created to track the Value.gcPtr for the Value finalizer.
589589
var allocTests = []struct {
590-
argLen int // The number of arguments to use for the syscall
590+
argLen int // The number of arguments to use for the syscall
591591
expected int // The expected number of allocations
592592
}{
593593
// For less than or equal to 16 arguments, we expect 1 alloction:
594594
// - makeValue new(ref)
595-
{0, 1},
596-
{2, 1},
595+
{0, 1},
596+
{2, 1},
597597
{15, 1},
598598
{16, 1},
599599
// For greater than 16 arguments, we expect 3 alloction:
@@ -613,7 +613,7 @@ func TestCallAllocations(t *testing.T) {
613613
tmpArray := js.Global().Get("Array").New(0)
614614
numAllocs := testing.AllocsPerRun(100, func() {
615615
tmpArray.Call("concat", args...)
616-
});
616+
})
617617

618618
if numAllocs != float64(test.expected) {
619619
t.Errorf("got numAllocs %#v, want %#v", numAllocs, test.expected)
@@ -630,7 +630,7 @@ func TestInvokeAllocations(t *testing.T) {
630630
concatFunc := tmpArray.Get("concat").Call("bind", tmpArray)
631631
numAllocs := testing.AllocsPerRun(100, func() {
632632
concatFunc.Invoke(args...)
633-
});
633+
})
634634

635635
if numAllocs != float64(test.expected) {
636636
t.Errorf("got numAllocs %#v, want %#v", numAllocs, test.expected)
@@ -647,7 +647,7 @@ func TestNewAllocations(t *testing.T) {
647647

648648
numAllocs := testing.AllocsPerRun(100, func() {
649649
arrayConstructor.New(args...)
650-
});
650+
})
651651

652652
if numAllocs != float64(test.expected) {
653653
t.Errorf("got numAllocs %#v, want %#v", numAllocs, test.expected)

0 commit comments

Comments
 (0)