io/fs: correct WalkDirFunc documentation

The documentation was copied from filepath.WalkFunc, and the copy was
not fully adjusted to the new circumstances.

Fixes #43536

Change-Id: I09687c7656e6938ebd9fc1e1643d34be88cf141d
Reviewed-on: https://go-review.googlesource.com/c/go/+/282172
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Marco Gazerro <gazerro@open2b.com>
This commit is contained in:
Ian Lance Taylor 2021-01-06 16:25:48 -08:00
parent 9b55088d6b
commit 091414b5b7

View File

@ -17,16 +17,11 @@ var SkipDir = errors.New("skip this directory")
// WalkDirFunc is the type of the function called by WalkDir to visit
// each file or directory.
//
// The path argument contains the argument to Walk as a prefix.
// That is, if Walk is called with root argument "dir" and finds a file
// The path argument contains the argument to WalkDir as a prefix.
// That is, if WalkDir is called with root argument "dir" and finds a file
// named "a" in that directory, the walk function will be called with
// argument "dir/a".
//
// The directory and file are joined with Join, which may clean the
// directory name: if Walk is called with the root argument "x/../dir"
// and finds a file named "a" in that directory, the walk function will
// be called with argument "dir/a", not "x/../dir/a".
//
// The d argument is the fs.DirEntry for the named path.
//
// The error result returned by the function controls how WalkDir
@ -42,9 +37,9 @@ var SkipDir = errors.New("skip this directory")
//
// WalkDir calls the function with a non-nil err argument in two cases.
//
// First, if the initial os.Lstat on the root directory fails, WalkDir
// First, if the initial fs.Stat on the root directory fails, WalkDir
// calls the function with path set to root, d set to nil, and err set to
// the error from os.Lstat.
// the error from fs.Stat.
//
// Second, if a directory's ReadDir method fails, WalkDir calls the
// function with path set to the directory's path, d set to an