go-git/go-billy

Example code on How to get an instance of an object/struct that implements billy.Filesystem?

Closed this issue · 1 comments

Hello folks,

I know it sounds like a rookie question and that surely is the case ...

not being such a golang guru, and trying to use https://github.com/go-git, I happened to come along the billy filesystem abstraction.

Well, I like abstraction and billy looks very fine so far, so I tried to get some instances but not achieving somehow. Then tried to get some example code and the only thing I find is the projects' homepage; but to no avail, because there is no source code where I could find out how to get an instance of type billy.Filesystem, only what to do with it if one has gotten one from somewhere. What I tried to code was something like:

myFileSystem := Filesystem (pathToFileSystem) and
myFileSystem := billy.Filesystem (pathToFileSystem)

and following the projects' statement on the homepage, stating that

each Filesystem implementation gives you a New method

i tried

myFileSystem := Filesystem.New (pathToFileSystem)
and myFileSystem := Basic.New (pathToFileSystem)
and myFileSystem := Dir.New (pathToFileSystem)

and even, prefixing the above with billy, like so:

myFileSystem := billy.Filesystem.New (pathToFileSystem)

I also tried a little bit around with ioutil ... but whatever I do, I dont find a constructor that takes a string path and gives back an instance of billy.Filesystem.

As mentioned, yes it might be a golang rookies' question and I might be as dumb as hell, but... please relieve me,...

Best Regards,

Michael

Edit: wayyy too much typos

Literally two seconds later I found the solution. osfs.New scrn