Skip to content

io/fs: errors in WalkDirFunc documentation #43536

@gazerro

Description

@gazerro

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions