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

Relax File interface requirements #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sheerun
Copy link
Contributor

@sheerun sheerun commented Jan 14, 2018

This PR removes the requirement of File to implement Name() method.

Reasons:

  1. Name doesn't always makes any sense (e.g. memfs)
  2. Prevents issues with implementation of fs.Name(), e.g. in my implementation I normalized relative path to absolute path and passed it to underlying os.Create(name). Then os.Name() returned absolute path what got passed to fs.Open() implementation that expected relative path on input and failed miserably. In principle the result of Name() should be the same as passed to name of Create() or Open(), so it makes little sense for File to implement this method by itself.
  3. I cannot think of use case someone wanted to implement this method in custom way
  4. It makes it easier to implement backend
  5. This change is 100% backward compatible

@djherbis
Copy link
Owner

I'm not confident this is a backwards compatible change since it removes a method. It might not break our library, but that doesn't mean it doesn't break clients of our library (and it does break some of those).

What if we did something like use path/filepath to normalize the paths even for the in-memory one?

I really appreciate the pull requests, though sometimes it might be worth discussing an idea (with an issue) before proposing the pull req.

@sheerun
Copy link
Contributor Author

sheerun commented Jan 18, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants