Skip to content

Commit e6f3196

Browse files
author
Elias Naur
committed
cmd/gomobile: use go list -f {{.Stale}} to determine staleness
With CL 107957, the appropriate way to check that the gomobile binary is up to date is by using go list -f {{.Stale}}. Use that instead of go install -x -n. Fixes golang/go#24389 Change-Id: I93a4428b048f0be9463c61928673886445dce3ed Reviewed-on: https://go-review.googlesource.com/108055 Reviewed-by: Daniel Martí <[email protected]> Reviewed-by: Sun Shine <[email protected]>
1 parent ada9ee7 commit e6f3196

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cmd/gomobile/version.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os"
1111
"os/exec"
1212
"path/filepath"
13+
"strings"
1314
)
1415

1516
var cmdVersion = &command{
@@ -33,13 +34,13 @@ func runVersion(cmd *command) (err error) {
3334
return "", err
3435
}
3536
bindir := filepath.Dir(bin)
36-
cmd := exec.Command("go", "install", "-x", "-n", "golang.org/x/mobile/cmd/gomobile")
37+
cmd := exec.Command("go", "list", "-f", "{{.Stale}}", "golang.org/x/mobile/cmd/gomobile")
3738
cmd.Env = append(os.Environ(), "GOBIN="+bindir)
3839
out, err := cmd.CombinedOutput()
3940
if err != nil {
4041
return "", fmt.Errorf("cannot test gomobile binary: %v, %s", err, out)
4142
}
42-
if len(out) != 0 {
43+
if strings.TrimSpace(string(out)) != "false" {
4344
return "", fmt.Errorf("binary is out of date, re-install it")
4445
}
4546
return mobileRepoRevision()

0 commit comments

Comments
 (0)