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

[Feature] import ideas from io/fs proposal #19

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

puellanivis
Copy link
Owner

@puellanivis puellanivis commented Jul 22, 2020

In the current proposal about io/fs the design of using a basic minimal core interface, and then extension interfaces to expand optional features is a great one. There are a number of handlers that I have that cannot do lists, or ReadDirs, and as of now, they had to be written to return an opaque not supported error.

With the new design idea of extension interfaces, we can just not implement them, and allow them to be automatically handled earlier up the tree.

As I’m going through, I’m also clearing out files.PathError calls to direct &os.PathError{} (finally), and squishing bugs as I find them.

As things are, the new RegisterScheme uses a smaller, and easier to implement interface, that remains compatible with the old FileStore interface that was much bigger. The new files.ReadDir(…) recognizes legacy List(…) implementations, as well as modern ReadDir support, and files.List(…) is rewritten to just call files.ReadDir(…)

Some programs may run into some code issues, where files.Reader is no longer guaranteed to support Seek and files.Writer no longer is guaranteed to support Sync. You will have to rewrite code that depends on those in order to anticipate this potential narrowing of the interface. You can use files.SeekReader and files.SyncWriter as successors to the previous wider interface.

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.

1 participant