Skip to content

Commit

Permalink
cmd/go: add a missing curly-brace in the 'stale' command format string
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Bryan C. Mills committed Mar 18, 2020
1 parent 971f8a2 commit 6412750
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cmd/go/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 4 additions & 5 deletions src/cmd/go/testdata/script/install_cross_gobin.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6412750

Please sign in to comment.