diff --git a/src/os/path.go b/src/os/path.go index 30cc6c8b9841e..104b7ceaf7dad 100644 --- a/src/os/path.go +++ b/src/os/path.go @@ -58,6 +58,14 @@ func MkdirAll(path string, perm FileMode) error { return nil } +// 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 +// returns nil (no error). +func RemoveAll(path string) error { + return removeAll(path) +} + // endsWithDot reports whether the final component of path is ".". func endsWithDot(path string) bool { if path == "." { diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go index faee1287f112b..fe8b1faf2b3f2 100644 --- a/src/os/removeall_at.go +++ b/src/os/removeall_at.go @@ -13,7 +13,7 @@ import ( "syscall" ) -func RemoveAll(path string) error { +func removeAll(path string) error { if path == "" { // fail silently to retain compatibility with previous behavior // of RemoveAll. See issue 28830. diff --git a/src/os/removeall_noat.go b/src/os/removeall_noat.go index 80527e227c996..5a7dc263f08f2 100644 --- a/src/os/removeall_noat.go +++ b/src/os/removeall_noat.go @@ -11,11 +11,7 @@ import ( "syscall" ) -// 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 -// returns nil (no error). -func RemoveAll(path string) error { +func removeAll(path string) error { if path == "" { // fail silently to retain compatibility with previous behavior // of RemoveAll. See issue 28830.