mirror of https://github.com/golang/go.git
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 <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Damien Neil <dneil@google.com>
This commit is contained in:
parent
7a92c4fc63
commit
cd8d1bca2c
|
|
@ -129,7 +129,8 @@ func TestMain(m *testing.M) {
|
|||
}
|
||||
callerPos = fmt.Sprintf("%s:%d: ", file, line)
|
||||
}
|
||||
return fmt.Errorf("%stestgo must not write to GOROOT (installing to %s)", callerPos, filepath.Join("GOROOT", rel))
|
||||
notice := "This error error can occur if GOROOT is stale, in which case rerunning make.bash will fix it."
|
||||
return fmt.Errorf("%stestgo must not write to GOROOT (installing to %s) (%v)", callerPos, filepath.Join("GOROOT", rel), notice)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue