io/fs: SubFS.Open returns incorrect errors for invalid paths #65419
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 go1.21.1 linux/arm64
Output of
go env
in your module/workspace:What did you do?
The documentation for the
fs.FS
interface says:The errors returned by
SubFS.Open()
do not fulfill this contract, as demonstrated by https://go.dev/play/p/N5lvehlpeB5. Calling Open with an invalid path returns a *PathError with Err set toerrors.New("invalid name")
instead. This breaks any code that accepts anfs.FS
and attempts to handle the documented errors.What did you see happen?
What did you expect to see?
The text was updated successfully, but these errors were encountered: