From 6412750f32224f6820f781d09b2092c5c358dddc Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 17 Mar 2020 15:17:22 -0400 Subject: [PATCH] cmd/go: add a missing curly-brace in the 'stale' command format string The missing brace made the 'stale' command a no-op in the non-error case. Fix the 'short' skip in install_cross_gobin (it was backward) and update it to no longer check staleness of a not-necessarily-stale target and to no longer expect to be able to install into GOROOT/pkg. (This was missed in #30316 because that part of the test was erroneously skipped in non-short mode.) Change-Id: I6a276fec5fa5e5da3fe0daf0c2b5086116ed7c1a Reviewed-on: https://go-review.googlesource.com/c/go/+/223747 Run-TryBot: Bryan C. Mills Reviewed-by: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/cmd/go/script_test.go | 2 +- src/cmd/go/testdata/script/install_cross_gobin.txt | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go index 00c6523cbc674e..e83782a24aa91c 100644 --- a/src/cmd/go/script_test.go +++ b/src/cmd/go/script_test.go @@ -759,7 +759,7 @@ func (ts *testScript) cmdStale(neg bool, args []string) { if len(args) == 0 { ts.fatalf("usage: stale target...") } - tmpl := "{{if .Error}}{{.ImportPath}}: {{.Error.Err}}{else}}" + tmpl := "{{if .Error}}{{.ImportPath}}: {{.Error.Err}}{{else}}" if neg { tmpl += "{{if .Stale}}{{.ImportPath}} is unexpectedly stale{{end}}" } else { diff --git a/src/cmd/go/testdata/script/install_cross_gobin.txt b/src/cmd/go/testdata/script/install_cross_gobin.txt index 57c18be602b636..33d48fce89915c 100644 --- a/src/cmd/go/testdata/script/install_cross_gobin.txt +++ b/src/cmd/go/testdata/script/install_cross_gobin.txt @@ -1,5 +1,5 @@ env GO111MODULE=off -[!short] skip # rebuilds std for alternate architecture +[short] skip # rebuilds std for alternate architecture cd mycmd go build mycmd @@ -16,10 +16,9 @@ env GOBIN=$WORK/bin ! go install mycmd ! exists $GOBIN/linux_$GOARCH -# installing standard command should still work -# (should also be mtime update only if cmd/pack is up-to-date). -! stale cmd/pack -[!short] go install cmd/pack +# The install directory for a cross-compiled standard command should include GOARCH. +go list -f '{{.Target}}' cmd/pack +stdout ${GOROOT}[/\\]pkg[/\\]tool[/\\]${GOOS}_${GOARCH}[/\\]pack$ -- mycmd/x.go -- package main