Skip to content

Commit 6412750

Browse files
author
Bryan C. Mills
committed
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 971f8a2 commit 6412750

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/cmd/go/script_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ func (ts *testScript) cmdStale(neg bool, args []string) {
759759
if len(args) == 0 {
760760
ts.fatalf("usage: stale target...")
761761
}
762-
tmpl := "{{if .Error}}{{.ImportPath}}: {{.Error.Err}}{else}}"
762+
tmpl := "{{if .Error}}{{.ImportPath}}: {{.Error.Err}}{{else}}"
763763
if neg {
764764
tmpl += "{{if .Stale}}{{.ImportPath}} is unexpectedly stale{{end}}"
765765
} else {

src/cmd/go/testdata/script/install_cross_gobin.txt

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
env GO111MODULE=off
2-
[!short] skip # rebuilds std for alternate architecture
2+
[short] skip # rebuilds std for alternate architecture
33

44
cd mycmd
55
go build mycmd
@@ -16,10 +16,9 @@ env GOBIN=$WORK/bin
1616
! go install mycmd
1717
! exists $GOBIN/linux_$GOARCH
1818

19-
# installing standard command should still work
20-
# (should also be mtime update only if cmd/pack is up-to-date).
21-
! stale cmd/pack
22-
[!short] go install cmd/pack
19+
# The install directory for a cross-compiled standard command should include GOARCH.
20+
go list -f '{{.Target}}' cmd/pack
21+
stdout ${GOROOT}[/\\]pkg[/\\]tool[/\\]${GOOS}_${GOARCH}[/\\]pack$
2322

2423
-- mycmd/x.go --
2524
package main

0 commit comments

Comments
 (0)