Skip to content

io/fs: invalid path in DirEntry.Name documentation example #47485

@gazerro

Description

@gazerro

The example in the documentation of the DirEntry.Name method, in the io/fs package, refers to the path /home/gopher/hello.go

// Name returns the name of the file (or subdirectory) described by the entry.
// This name is only the final element of the path (the base name), not the entire path.
// For example, Name would return "hello.go" not "/home/gopher/hello.go".
Name() string

but it cannot be the entire path because it is not a valid path. It should be home/gopher/hello.go, without the leading slash.

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.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions