summaryrefslogtreecommitdiff
path: root/src/os/path.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/path.go')
-rw-r--r--src/os/path.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/os/path.go b/src/os/path.go
index 02a77ec80..24a3415b4 100644
--- a/src/os/path.go
+++ b/src/os/path.go
@@ -66,7 +66,7 @@ func MkdirAll(path string, perm FileMode) error {
func RemoveAll(path string) error {
// Simple case: if Remove works, we're done.
err := Remove(path)
- if err == nil {
+ if err == nil || IsNotExist(err) {
return nil
}
@@ -86,6 +86,11 @@ func RemoveAll(path string) error {
// Directory.
fd, err := Open(path)
if err != nil {
+ if IsNotExist(err) {
+ // Race. It was deleted between the Lstat and Open.
+ // Return nil per RemoveAll's docs.
+ return nil
+ }
return err
}
@@ -116,6 +121,9 @@ func RemoveAll(path string) error {
// Remove directory.
err1 := Remove(path)
+ if err1 == nil || IsNotExist(err1) {
+ return nil
+ }
if err == nil {
err = err1
}