src-d / go-billy

The missing interface filesystem abstraction for Go
https://godoc.org/gopkg.in/src-d/go-billy.v4
Apache License 2.0
199 stars 43 forks source link

Use spf13/afero or provide a compatibility layer? #64

Open purpleidea opened 6 years ago

purpleidea commented 6 years ago

I use https://github.com/spf13/afero/ in a number of ways. I wanted to use https://github.com/src-d/go-git/ with that as the backing filesystem. As a result, I'd have to either switch to this, or implement a compatibility layer. Since the former is not possible, I think the later might be a good approach.

I'm opening this issue to track that progress. Basically we should have a helper function which takes a fileystem from afero and returns something that implements this interface. That should probably be in the afero lib, and the opposite should be here.

mcuadros commented 5 years ago

@purpleidea I recommend implementing a billy.Filesystem on top of an afero one. We are open for PRs

twpayne commented 5 years ago

FWIW I implemented this Afero compatibility for go-vfs with go-vfsafero using exactly the idea that @purpleidea describes here.

jfontan commented 5 years ago

I've started a go-billy fs that uses afero as a backend. Still needs documentation but you should be able to wrap it with:

billyfs := desfacer.New(aferofs)

https://github.com/jfontan/go-billy-desfacer

grzesiek commented 5 years ago

+1