<script src="https://cdn.jsdelivr.net/npm/text-encoding@0.7.0/lib/encoding.min.js"></script>
(see https://caniuse.com/#feat=textencoder)
-->
- <script src="wasm_exec.js"></script>
+ <script src="../../lib/wasm/wasm_exec.js"></script>
<script>
if (!WebAssembly.instantiateStreaming) { // polyfill
WebAssembly.instantiateStreaming = async (resp, importObject) => {
{name: "golang.org/toolchain@*/src/cmd/go/main.go"},
{name: "golang.org/toolchain@*/src/bytes/bytes.go"},
+ {name: "golang.org/toolchain@*/lib/wasm/go_js_wasm_exec"},
+ {name: "golang.org/toolchain@*/lib/wasm/go_wasip1_wasm_exec"},
+ {name: "golang.org/toolchain@*/lib/wasm/wasm_exec.js"},
+ {name: "golang.org/toolchain@*/lib/wasm/wasm_exec_node.js"},
+
{name: "**/.DS_Store", exclude: true},
{name: "golang.org/toolchain@*/.git", exclude: true},
{name: "golang.org/toolchain@*/.gitattributes", exclude: true},
base.Fatalf("download %s: %v", gotoolchain, err)
}
if info.Mode()&0111 == 0 {
- // allowExec sets the exec permission bits on all files found in dir.
- allowExec := func(dir string) {
+ // allowExec sets the exec permission bits on all files found in dir if pattern is the empty string,
+ // or only those files that match the pattern if it's non-empty.
+ allowExec := func(dir, pattern string) {
err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if !d.IsDir() {
+ if pattern != "" {
+ if matched, _ := filepath.Match(pattern, d.Name()); !matched {
+ // Skip file.
+ return nil
+ }
+ }
info, err := os.Stat(path)
if err != nil {
return err
// then the check of bin/go above might succeed, the other go command
// would skip its own mode-setting, and then the go command might
// try to run a tool before we get to setting the bits on pkg/tool.
- // Setting pkg/tool before bin/go avoids that ordering problem.
+ // Setting pkg/tool and lib before bin/go avoids that ordering problem.
// The only other tool the go command invokes is gofmt,
// so we set that one explicitly before handling bin (which will include bin/go).
- allowExec(filepath.Join(dir, "pkg/tool"))
- allowExec(filepath.Join(dir, "bin/gofmt"))
- allowExec(filepath.Join(dir, "bin"))
+ allowExec(filepath.Join(dir, "pkg/tool"), "")
+ allowExec(filepath.Join(dir, "lib"), "go_?*_?*_exec")
+ allowExec(filepath.Join(dir, "bin/gofmt"), "")
+ allowExec(filepath.Join(dir, "bin"), "")
}
}