You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, on Unix and Darwin, the Readdir and Readdirnames methods do not: instead, they returns a *os.SyscallError that does not include the path:
This not only violates the general expectations for error descriptiveness in the standard library, but also makes the behavior inconsistent across platforms: Windows and Plan 9 both already return a *PathError from these methods.
In general, when
*os.File
methods fail they return aPathError
referring to the failing operation and the name of the file:go/src/os/stat_unix.go
Lines 20 to 23 in a38a917
Unfortunately, on Unix and Darwin, the
Readdir
andReaddirnames
methods do not: instead, they returns a*os.SyscallError
that does not include the path:go/src/os/dir_unix.go
Lines 52 to 54 in a38a917
go/src/os/dir_darwin.go
Lines 30 to 32 in a38a917
This not only violates the general expectations for error descriptiveness in the standard library, but also makes the behavior inconsistent across platforms: Windows and Plan 9 both already return a
*PathError
from these methods.CC @ianlancetaylor @bradfitz
The text was updated successfully, but these errors were encountered: