-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os: add ModeIrregular flag #23878
Comments
"Unknown" sounds like not knowing anything. We know it's not regular. |
Does sound worth doing though, modulo the name. |
|
Change https://golang.org/cl/94856 mentions this issue: |
Was reverted. Reopening. |
We ended up rolling forward with a fix in: https://go-review.googlesource.com/103616 |
Ah, whoops. Great. I approved the API change (+ saw the revert CL created) but I missed that the revert was abandoned. |
The
os.FileInfo
type is an interface, allowing other packages to implement it. One of the fields it returns isMode
which reports two pieces of information: 1) what the permissions are, and 2) what type of file it is. There is a helper methodos.FileMode.IsRegular
that reports whether the file is regular or not. Currently the only way to haveIsRegular
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. TheModeUnknown
type carries no information other than the fact that the file is not regular.CL/94856 is one such implementation.
\cc @bradfitz @ianlancetaylor @robpike @rsc
The text was updated successfully, but these errors were encountered: