@@ -4,7 +4,7 @@ package memfs // import "github.com/go-git/go-billy/v6/memfs"
44import (
55 "errors"
66 "fmt"
7- "io/fs"
7+ gofs "io/fs"
88 "log"
99 "os"
1010 "path/filepath"
@@ -49,7 +49,7 @@ func (fs *Memory) Open(filename string) (billy.File, error) {
4949 return fs .OpenFile (filename , os .O_RDONLY , 0 )
5050}
5151
52- func (fs * Memory ) OpenFile (filename string , flag int , perm fs .FileMode ) (billy.File , error ) {
52+ func (fs * Memory ) OpenFile (filename string , flag int , perm gofs .FileMode ) (billy.File , error ) {
5353 f , has := fs .s .Get (filename )
5454 if ! has {
5555 if ! isCreate (flag ) {
@@ -132,13 +132,13 @@ func (fs *Memory) Lstat(filename string) (os.FileInfo, error) {
132132 return f .Stat ()
133133}
134134
135- type ByName []os. FileInfo
135+ type ByName []gofs. DirEntry
136136
137137func (a ByName ) Len () int { return len (a ) }
138138func (a ByName ) Less (i , j int ) bool { return a [i ].Name () < a [j ].Name () }
139139func (a ByName ) Swap (i , j int ) { a [i ], a [j ] = a [j ], a [i ] }
140140
141- func (fs * Memory ) ReadDir (path string ) ([]os. FileInfo , error ) {
141+ func (fs * Memory ) ReadDir (path string ) ([]gofs. DirEntry , error ) {
142142 if f , has := fs .s .Get (path ); has {
143143 if target , isLink := fs .resolveLink (path , f ); isLink {
144144 if target != path {
@@ -149,18 +149,18 @@ func (fs *Memory) ReadDir(path string) ([]os.FileInfo, error) {
149149 return nil , & os.PathError {Op : "open" , Path : path , Err : syscall .ENOENT }
150150 }
151151
152- var entries []os. FileInfo
152+ var entries []gofs. DirEntry
153153 for _ , f := range fs .s .Children (path ) {
154154 fi , _ := f .Stat ()
155- entries = append (entries , fi )
155+ entries = append (entries , gofs . FileInfoToDirEntry ( fi ) )
156156 }
157157
158158 sort .Sort (ByName (entries ))
159159
160160 return entries , nil
161161}
162162
163- func (fs * Memory ) MkdirAll (path string , perm fs .FileMode ) error {
163+ func (fs * Memory ) MkdirAll (path string , perm gofs .FileMode ) error {
164164 _ , err := fs .s .New (path , perm | os .ModeDir , 0 )
165165 return err
166166}
@@ -258,6 +258,6 @@ func isWriteOnly(flag int) bool {
258258 return flag & os .O_WRONLY != 0
259259}
260260
261- func isSymlink (m fs .FileMode ) bool {
261+ func isSymlink (m gofs .FileMode ) bool {
262262 return m & os .ModeSymlink != 0
263263}
0 commit comments