Skip to content
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

Closed
dsnet opened this issue Feb 16, 2018 · 7 comments
Closed

os: add ModeIrregular flag #23878

dsnet opened this issue Feb 16, 2018 · 7 comments

Comments

@dsnet
Copy link
Member

dsnet commented Feb 16, 2018

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.

\cc @bradfitz @ianlancetaylor @robpike @rsc

@gopherbot gopherbot added this to the Proposal milestone Feb 16, 2018
@rsc
Copy link
Contributor

rsc commented Feb 26, 2018

"Unknown" sounds like not knowing anything. We know it's not regular.
ModeOther? ModeIrregular? ModeSpecial?

@rsc
Copy link
Contributor

rsc commented Feb 26, 2018

Does sound worth doing though, modulo the name.

@dsnet
Copy link
Member Author

dsnet commented Feb 26, 2018

ModeIrregular SGTM. The name exactly reflects what it means.

@rsc rsc changed the title proposal: os: add ModeUnknown flag os: add ModeIrregular flag Mar 5, 2018
@rsc rsc modified the milestones: Proposal, Go1.11 Mar 5, 2018
@gopherbot
Copy link

Change https://golang.org/cl/94856 mentions this issue: os: add ModeIrregular flag

@bradfitz
Copy link
Contributor

Was reverted. Reopening.

@dsnet
Copy link
Member Author

dsnet commented Mar 30, 2018

We ended up rolling forward with a fix in: https://go-review.googlesource.com/103616
So the revert didn't happen.

@dsnet dsnet closed this as completed Mar 30, 2018
@bradfitz
Copy link
Contributor

Ah, whoops. Great. I approved the API change (+ saw the revert CL created) but I missed that the revert was abandoned.

@golang golang locked and limited conversation to collaborators Mar 30, 2019
@rsc rsc unassigned dsnet Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants