-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
The os.FileInfo
type is an interface, allowing other packages to implement it. One of the fields it returns is Mode
which reports two pieces of information: 1) what the permissions are, and 2) what type of file it is. There is a helper method os.FileMode.IsRegular
that reports whether the file is regular or not. Currently the only way to have IsRegular
report false is to set the type to be one of the following:
ModeDir
|ModeSymlink
|ModeNamedPipe
|ModeSocket
|ModeDevice
For some implementations of os.FileInfo
(see #22903 for an example), we want to be able to indicate that the file is not regular. However, every one of the aforementioned types to indicate non-regular are ill-suited as a general-purpose "unknown" file type.
Thus, I propose adding a ModeUnknown
to serve exactly for that purpose. The ModeUnknown
type carries no information other than the fact that the file is not regular.
CL/94856 is one such implementation.