return nil
}
-// removeAllTestHook is a hook for testing.
-var removeAllTestHook = func(err error) error { return err }
-
// RemoveAll removes path and any children it contains.
// It removes everything it can but returns the first error
// it encounters. If the path does not exist, RemoveAll
return
}
if err == nil {
+ if runtime.GOOS == "windows" {
+ // Marking a directory as read-only in Windows does not prevent the RemoveAll
+ // from creating or removing files within it.
+ return
+ }
t.Fatal("RemoveAll(<read-only directory>) = nil; want error")
}
}
defer dir.Close()
- if runtime.GOOS == "windows" {
- // Marking a directory in Windows does not prevent the os package from
- // creating or removing files within it.
- // (See https://golang.org/issue/35042.)
- return
- }
-
names, _ := dir.Readdirnames(1025)
if len(names) < 1025 {
t.Fatalf("RemoveAll(<read-only directory>) unexpectedly removed %d read-only files from that directory", 1025-len(names))