]> Cypherpunks.ru repositories - gostls13.git/commit
io/fs: add WalkDir
authorRuss Cox <rsc@golang.org>
Sun, 19 Jul 2020 05:31:05 +0000 (01:31 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 6 Nov 2020 19:42:05 +0000 (19:42 +0000)
commit362d25f2c82980860cb4eb5bfd0648116504788d
tree3ea587edcceacfa225e767cddf6dd59dad06fcc9
parentd21af00dd22d478d0026797c91961168ba83aff9
io/fs: add WalkDir

This commit is a copy of filepath.WalkDir adapted to use fs.FS
instead of the native OS file system. It is the last implementation
piece of the io/fs proposal.

The original io/fs proposal was to adopt filepath.Walk, but we
have since introduced the more efficient filepath.WalkDir (#42027),
so this CL adopts that more efficient option instead.

(The changes in path/filepath bring the two copies more in line
with each other. The main change is unembedding the field
in statDirEntry, so that the fs.DirEntry passed to the WalkDirFunc
for the root of the tree does not have any extra methods.)

For #41190.

Change-Id: I9359dfcc110338c0ec64535f22cafb38d0b613a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/243916
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/io/fs/walk.go [new file with mode: 0644]
src/io/fs/walk_test.go [new file with mode: 0644]
src/path/filepath/export_test.go
src/path/filepath/path.go
src/path/filepath/path_test.go