Skip to content

Commit cd8d1bc

Browse files
committed
cmd/go: more informative test failures when GOROOT is stale
If GOROOT is stale, test fail when commands unexpectedly write to GOROOT. Include an message in the test failure indicating that this is a possible and expected reason for the failure, and how to fix it. For #48698. Change-Id: I057c20260bab09aebf684e8f20794ab8fc0ede1e Reviewed-on: https://go-review.googlesource.com/c/go/+/448895 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Damien Neil <[email protected]>
1 parent 7a92c4f commit cd8d1bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cmd/go/go_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ func TestMain(m *testing.M) {
129129
}
130130
callerPos = fmt.Sprintf("%s:%d: ", file, line)
131131
}
132-
return fmt.Errorf("%stestgo must not write to GOROOT (installing to %s)", callerPos, filepath.Join("GOROOT", rel))
132+
notice := "This error error can occur if GOROOT is stale, in which case rerunning make.bash will fix it."
133+
return fmt.Errorf("%stestgo must not write to GOROOT (installing to %s) (%v)", callerPos, filepath.Join("GOROOT", rel), notice)
133134
}
134135
}
135136

0 commit comments

Comments
 (0)