Skip to content

Commit

Permalink
os: restore RemoveAll docs by making a single copy
Browse files Browse the repository at this point in the history
Updates #29983

Change-Id: Ifdf8aa9c92e053374e301a4268d85e277c15f0b5
Reviewed-on: https://go-review.googlesource.com/c/160182
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
ianlancetaylor committed Jan 30, 2019
1 parent da648ea commit ea27cd3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/os/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "." {
Expand Down
2 changes: 1 addition & 1 deletion src/os/removeall_at.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions src/os/removeall_noat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ea27cd3

Please sign in to comment.