1
0
mirror of https://github.com/golang/go synced 2024-11-23 02:10:03 -07:00

cmd/distpack: make go_$GOOS_$GOARCH_exec programs executable

The go command recognizes when a program named go_$GOOS_$GOARCH_exec
is in PATH. There are two such programs living in GOROOT/misc/wasm.
Like GOROOT/bin/{go,gofmt} and GOROOT/pkg/tool/**, these programs
need to have the executable bit set to do their job, so set it.

Comparing a distpack produced before and after this change shows that
the pack.go file is modified, the two go_{js,wasip1}_wasm_exec programs
have the new file mode, and there are no other changes, as expected.

The mode change is relevant to the binary and source distributions only.
No change to the module zip since it doesn't include GOROOT/misc at all,
so no effect on previously created toolchain modules whose checksums
are already recorded in the Go checksum database and cannot be changed.
(Other than by changing their "v0.0.1" version, but that's expensive.)

Fixes #60843.

Change-Id: I799b6aacff59c0785cb7743cbd17dda5a9ef91be
Reviewed-on: https://go-review.googlesource.com/c/go/+/503975
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Dmitri Shuralyov 2023-06-16 09:03:11 -04:00 committed by Gopher Robot
parent 1a7709d6af
commit 4eceefa338

View File

@ -235,6 +235,8 @@ func mode(name string, _ fs.FileMode) fs.FileMode {
strings.HasSuffix(name, ".pl") ||
strings.HasSuffix(name, ".rc") {
return 0o755
} else if ok, _ := amatch("**/go_?*_?*_exec", name); ok {
return 0o755
}
return 0o644
}