You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the new WalkDir API, if the readdir fails, the walkDirFn will be called for a second time, with the readdir error.
The doc says
// The error result returned by the function controls how Walk continues.
// If the function returns the special value SkipDir, Walk skips the
// current directory (path if info.IsDir() is true, otherwise path's
// parent directory). Otherwise, if the function returns a non-nil error,
// Walk stops entirely and returns that error.
If the walkDirFn do return a SkipDir for this second call, it would be returned(
) it. So it would not cause Walk to stop walking the entire tree and not only skips the current directory, but also skips path's parent directory even though info.IsDir() is true.
And the doc also says
// The err argument reports an error related to path, signaling that Walk
// will not walk into that directory.
But there is a way letting it walk into the possible partial dentry list by returning nil from the walkDirFn.
These behaviors are different from the Walk func. Is it intentional for them to work like this? If it is, it would be better to have them documented out.
The text was updated successfully, but these errors were encountered:
With the new
WalkDir
API, if the readdir fails, the walkDirFn will be called for a second time, with the readdir error.The doc says
If the walkDirFn do return a SkipDir for this second call, it would be returned(
go/src/path/filepath/path.go
Lines 394 to 402 in 7b1ba97
go/src/path/filepath/path.go
Lines 403 to 411 in 7b1ba97
cause Walk to stop walking the entire tree
and not onlyskips the current directory
, but also skipspath's parent directory
even thoughinfo.IsDir() is true
.And the doc also says
But there is a way letting it walk into the possible partial dentry list by returning nil from the walkDirFn.
These behaviors are different from the
Walk
func. Is it intentional for them to work like this? If it is, it would be better to have them documented out.The text was updated successfully, but these errors were encountered: