aboutsummaryrefslogtreecommitdiff
path: root/src/path/filepath/path.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-03-12 16:18:23 -0800
committerIan Lance Taylor <iant@golang.org>2022-03-28 22:03:07 +0000
commit460fd63cccd2f1d16fc4b1b761545b1649e14e28 (patch)
treed578069779c03ac6c2dc2ae2b427ce0d62014db6 /src/path/filepath/path.go
parent3c7f9b80222376fa01f8c6e3b411281c23dd74ed (diff)
downloadgo-460fd63cccd2f1d16fc4b1b761545b1649e14e28.tar.xz
io/fs, path/filepath: honor SkipDir on second WalkDirFunc error call
Fixes #51617 Change-Id: I03e9e575d9bad1481e7e4f051b50a077ba5f2fe0 Reviewed-on: https://go-review.googlesource.com/c/go/+/392154 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Diffstat (limited to 'src/path/filepath/path.go')
-rw-r--r--src/path/filepath/path.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go
index b56534dead..0554deb2ff 100644
--- a/src/path/filepath/path.go
+++ b/src/path/filepath/path.go
@@ -396,6 +396,9 @@ func walkDir(path string, d fs.DirEntry, walkDirFn fs.WalkDirFunc) error {
// Second call, to report ReadDir error.
err = walkDirFn(path, d, err)
if err != nil {
+ if err == SkipDir && d.IsDir() {
+ err = nil
+ }
return err
}
}