os: dirFS.ReadFile returns inconsistent PathError.Path #64366
Labels
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Go version
go version devel go1.22-3188758653 Fri Nov 10 21:25:30 2023 +0000 linux/amd64
Reproducibility
What operating system and processor architecture are you using (
go env
)?What did you do?
https://go.dev/play/p/5vKYCOeV5gd
What did you expect to see?
What did you see instead?
The
PathError
returned fromfs.ReadFile
is reflecting the path of the underlying os implementation rather than thefs.FS
name. It should be the same regardless of whether the FS implementation implementsReadFile
or not.I think the
dirFS.ReadFile
method should probably inspect the returned error and transform paths when it's a PathError.Also, the
io/fs
documentation could be clearer about the requirements for error returns throughout the API.The text was updated successfully, but these errors were encountered: