Skip to content

io/fs: misleading documentation of Glob function #43537

@gazerro

Description

@gazerro

The documentation of the new fs.Glob function is a bit misleading.

When it says

Glob returns the names of all files matching pattern or nil if there is no matching file. The syntax of patterns is the same as in path.Match. The pattern may describe hierarchical names such as /usr/*/bin/ed (assuming the Separator is '/').

the last sentence is correct but refers to a specific OS file system implementation, as the file system returned by the os.DirFS function. If "/usr/*/bin/ed" is used as pattern argument to Glob, it will never return any files because the names returned by Glob are unrooted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions