go-billy icon indicating copy to clipboard operation
go-billy copied to clipboard

Question: Relation to io/fs?

Open nmeum opened this issue 4 years ago • 5 comments

How does this library relate to the io/fs draft which has been accepted recently and will be a part of go 1.16, which is scheduled to be released in February? How will this affect go-git and will go-git migrate to io/fs?

nmeum avatar Dec 29 '20 11:12 nmeum

Just reading the abstract, the io/fs draft says it is for read-only filetrees so it wouldn't be suitable replacement for go-git's go-billy filesystem. So maybe that isn't what you are asking - of not can you clarify?

happybeing avatar Dec 29 '20 12:12 happybeing

My understanding is that support for writeable files is supposed to be added later on:

It's true that if we later want to add writing, […]

It should also be possible to employ the extension pattern to implement write-related functionality on top of fs.FS in the meantime [1]:

Although the initial interface is limited to read-only file systems, the design can be extended to support write operations later, even from third-party packages.

nmeum avatar Dec 29 '20 12:12 nmeum

Reading the issue comment (your "supposed..." link), it doesn't sound like there's an intention to support writing yet, but to put it off and maybe not do it at all. Yes, he acknowledges it could be added later, but it doesn't seem to be in the mind of the poster to do that. Read the last line.

So I think your question is moot for now, but I'm not replying in behalf of the maintainers. I was curious about the possibility because I've been using go-billy recently and think it would be useful to have that kind of flexibility in io/fs.

Do you have a reason to want this convergence?

happybeing avatar Dec 29 '20 13:12 happybeing

So I think your question is moot for now, […]

As I said: One can use the extension pattern to implement missing functionality.

Do you have a reason to want this convergence?

Yes, io/fs is much closer integrated with the standard library. For example, you can simply pass an fs.FS to a http.FileServer many other functions from the standard library have also been adjusted accordingly. The draft further explains the advantages of this approach, please consult it if you seek more information.

nmeum avatar Dec 29 '20 13:12 nmeum

Something like https://github.com/forensicanalysis/gitfs to make them compatible would be nice to have out-of-the-box.

luisdavim avatar Dec 30 '21 14:12 luisdavim