@@ -29,6 +29,7 @@ import (
29
29
30
30
"cmd/go/internal/cache"
31
31
"cmd/go/internal/cfg"
32
+ "cmd/go/internal/robustio"
32
33
"cmd/internal/sys"
33
34
)
34
35
@@ -685,7 +686,7 @@ func (tg *testgoData) creatingTemp(path string) {
685
686
if tg .wd != "" && ! filepath .IsAbs (path ) {
686
687
path = filepath .Join (tg .pwd (), path )
687
688
}
688
- tg .must (os .RemoveAll (path ))
689
+ tg .must (robustio .RemoveAll (path ))
689
690
tg .temps = append (tg .temps , path )
690
691
}
691
692
@@ -887,7 +888,7 @@ func removeAll(dir string) error {
887
888
}
888
889
return nil
889
890
})
890
- return os .RemoveAll (dir )
891
+ return robustio .RemoveAll (dir )
891
892
}
892
893
893
894
// failSSH puts an ssh executable in the PATH that always fails.
@@ -1181,7 +1182,7 @@ func testMove(t *testing.T, vcs, url, base, config string) {
1181
1182
case "svn" :
1182
1183
// SVN doesn't believe in text files so we can't just edit the config.
1183
1184
// Check out a different repo into the wrong place.
1184
- tg .must (os .RemoveAll (tg .path ("src/code.google.com/p/rsc-svn" )))
1185
+ tg .must (robustio .RemoveAll (tg .path ("src/code.google.com/p/rsc-svn" )))
1185
1186
tg .run ("get" , "-d" , "-u" , "code.google.com/p/rsc-svn2/trunk" )
1186
1187
tg .must (os .Rename (tg .path ("src/code.google.com/p/rsc-svn2" ), tg .path ("src/code.google.com/p/rsc-svn" )))
1187
1188
default :
@@ -1693,7 +1694,7 @@ func TestInstalls(t *testing.T) {
1693
1694
goarch := strings .TrimSpace (tg .getStdout ())
1694
1695
tg .setenv ("GOARCH" , goarch )
1695
1696
fixbin := filepath .Join (goroot , "pkg" , "tool" , goos + "_" + goarch , "fix" ) + exeSuffix
1696
- tg .must (os .RemoveAll (fixbin ))
1697
+ tg .must (robustio .RemoveAll (fixbin ))
1697
1698
tg .run ("install" , "cmd/fix" )
1698
1699
tg .wantExecutable (fixbin , "did not install cmd/fix to $GOROOT/pkg/tool" )
1699
1700
tg .must (os .Remove (fixbin ))
@@ -2065,13 +2066,13 @@ func TestDefaultGOPATHGet(t *testing.T) {
2065
2066
tg .grepStderr ("created GOPATH=" + regexp .QuoteMeta (tg .path ("home/go" ))+ "; see 'go help gopath'" , "did not create GOPATH" )
2066
2067
2067
2068
// no warning if directory already exists
2068
- tg .must (os .RemoveAll (tg .path ("home/go" )))
2069
+ tg .must (robustio .RemoveAll (tg .path ("home/go" )))
2069
2070
tg .tempDir ("home/go" )
2070
2071
tg .run ("get" , "github.com/golang/example/hello" )
2071
2072
tg .grepStderrNot ("." , "expected no output on standard error" )
2072
2073
2073
2074
// error if $HOME/go is a file
2074
- tg .must (os .RemoveAll (tg .path ("home/go" )))
2075
+ tg .must (robustio .RemoveAll (tg .path ("home/go" )))
2075
2076
tg .tempFile ("home/go" , "" )
2076
2077
tg .runFail ("get" , "github.com/golang/example/hello" )
2077
2078
tg .grepStderr (`mkdir .*[/\\]go: .*(not a directory|cannot find the path)` , "expected error because $HOME/go is a file" )
@@ -2872,7 +2873,7 @@ func TestCgoDependsOnSyscall(t *testing.T) {
2872
2873
files , err := filepath .Glob (filepath .Join (runtime .GOROOT (), "pkg" , "*_race" ))
2873
2874
tg .must (err )
2874
2875
for _ , file := range files {
2875
- tg .check (os .RemoveAll (file ))
2876
+ tg .check (robustio .RemoveAll (file ))
2876
2877
}
2877
2878
tg .tempFile ("src/foo/foo.go" , `
2878
2879
package foo
@@ -3925,10 +3926,10 @@ func TestGoGetDomainRoot(t *testing.T) {
3925
3926
tg .run ("get" , "go-get-issue-9357.appspot.com" )
3926
3927
tg .run ("get" , "-u" , "go-get-issue-9357.appspot.com" )
3927
3928
3928
- tg .must (os .RemoveAll (tg .path ("src/go-get-issue-9357.appspot.com" )))
3929
+ tg .must (robustio .RemoveAll (tg .path ("src/go-get-issue-9357.appspot.com" )))
3929
3930
tg .run ("get" , "go-get-issue-9357.appspot.com" )
3930
3931
3931
- tg .must (os .RemoveAll (tg .path ("src/go-get-issue-9357.appspot.com" )))
3932
+ tg .must (robustio .RemoveAll (tg .path ("src/go-get-issue-9357.appspot.com" )))
3932
3933
tg .run ("get" , "-u" , "go-get-issue-9357.appspot.com" )
3933
3934
}
3934
3935
@@ -4513,8 +4514,9 @@ func TestLinkXImportPathEscape(t *testing.T) {
4513
4514
tg := testgo (t )
4514
4515
defer tg .cleanup ()
4515
4516
tg .parallel ()
4517
+ tg .makeTempdir ()
4516
4518
tg .setenv ("GOPATH" , filepath .Join (tg .pwd (), "testdata" ))
4517
- exe := "./ linkx" + exeSuffix
4519
+ exe := tg . path ( " linkx" + exeSuffix )
4518
4520
tg .creatingTemp (exe )
4519
4521
tg .run ("build" , "-o" , exe , "-ldflags" , "-X=my.pkg.Text=linkXworked" , "my.pkg/main" )
4520
4522
out , err := exec .Command (exe ).CombinedOutput ()
@@ -4750,7 +4752,7 @@ func TestExecutableGOROOT(t *testing.T) {
4750
4752
check (t , symGoTool , newRoot )
4751
4753
})
4752
4754
4753
- tg .must (os .RemoveAll (tg .path ("new/pkg" )))
4755
+ tg .must (robustio .RemoveAll (tg .path ("new/pkg" )))
4754
4756
4755
4757
// Binaries built in the new tree should report the
4756
4758
// new tree when they call runtime.GOROOT.
@@ -5101,7 +5103,7 @@ func TestExecBuildX(t *testing.T) {
5101
5103
if len (matches ) == 0 {
5102
5104
t .Fatal ("no WORK directory" )
5103
5105
}
5104
- tg .must (os .RemoveAll (matches [1 ]))
5106
+ tg .must (robustio .RemoveAll (matches [1 ]))
5105
5107
}
5106
5108
5107
5109
func TestParallelNumber (t * testing.T ) {
0 commit comments