-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
There are some errors in the documentation of the new fs.WalkDirFunc type, probably because copied from the filepath.WalkFunc documentation.
The fs.WalkDir function is called Walk several times instead of WalkDir as in "if Walk is called with root argument ...".
The documentation says:
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".
But if WalkDir is called with argument "x/../dir", the walk function is called with arguments "x/../dir" and a path error, and as documented below, the WalkDir will not walk into that directory so it will not call the walk function with argument "dir/a" as documented.
The documentation says:
First, if the initial os.Lstat 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.
Should be fs.Stat instead of os.Lstat. os.Lstat is related to the file system implementation.