We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bba63b commit c726361Copy full SHA for c726361
src/cmd/go/go_test.go
@@ -683,8 +683,11 @@ func (tg *testgoData) creatingTemp(path string) {
683
// If we have changed the working directory, make sure we have
684
// an absolute path, because we are going to change directory
685
// back before we remove the temporary.
686
- if tg.wd != "" && !filepath.IsAbs(path) {
687
- path = filepath.Join(tg.pwd(), path)
+ if !filepath.IsAbs(path) {
+ if tg.wd == "" || strings.HasPrefix(tg.wd, testGOROOT) {
688
+ tg.t.Fatalf("internal testsuite error: creatingTemp(%q) within GOROOT/src", path)
689
+ }
690
+ path = filepath.Join(tg.wd, path)
691
}
692
tg.must(robustio.RemoveAll(path))
693
tg.temps = append(tg.temps, path)
0 commit comments