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>
}
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)
}
}