Skip to content

Commit 11c5287

Browse files
hajimehoshiandydotxyz
authored andcommitted
cmd: replace goBin() with a plain string "go"
This was introduced at https://go-review.googlesource.com/c/mobile/+/191518 originally, but this change was against the decision at golang/go#26845. "go" always works even when Go command that name is not "go", like "go1.14beta1" is used. See also the discussion at golang/go#28043 Cherry picked from github.com/golang/mobile
1 parent b269076 commit 11c5287

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

cmd/fyne/internal/mobile/build.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,7 @@ func goCmd(subcmd string, srcs []string, env []string, args ...string) error {
316316
}
317317

318318
func goCmdAt(at string, subcmd string, srcs []string, env []string, args ...string) error {
319-
cmd := exec.Command(
320-
goBin(),
321-
subcmd,
322-
)
319+
cmd := exec.Command("go", subcmd)
323320
tags := buildTags
324321
targetOS, _, err := parseBuildTarget(buildTarget)
325322
if err != nil {

cmd/fyne/internal/mobile/init.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func goEnv(name string) string {
7171
if val := os.Getenv(name); val != "" {
7272
return val
7373
}
74-
val, err := exec.Command(goBin(), "env", name).Output()
74+
val, err := exec.Command("go", "env", name).Output()
7575
if err != nil {
7676
panic(err) // the Go tool was tested to work earlier
7777
}
@@ -88,12 +88,7 @@ func runCmd(cmd *exec.Cmd) error {
8888
if env != "" {
8989
env += " "
9090
}
91-
args := make([]string, len(cmd.Args))
92-
copy(args, cmd.Args)
93-
if args[0] == goBin() {
94-
args[0] = "go"
95-
}
96-
printcmd("%s%s%s", dir, env, strings.Join(args, " "))
91+
printcmd("%s%s%s", dir, env, strings.Join(cmd.Args, " "))
9792
}
9893

9994
buf := new(bytes.Buffer)

cmd/fyne/internal/mobile/main.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)