Documentation ¶
Overview ¶
Package fs provides a file system abstraction layer.
Index ¶
- type FakeFS
- func (fs *FakeFS) Create(name string) (File, error)
- func (fs *FakeFS) Mkdir(name string, perm os.FileMode) error
- func (fs *FakeFS) Open(name string) (File, error)
- func (fs *FakeFS) ReadFile(name string) ([]byte, error)
- func (fs *FakeFS) ReadFiles(name string) (map[string][]byte, error)
- func (fs *FakeFS) Stat(name string) (os.FileInfo, error)
- func (fs *FakeFS) WriteFile(name string, c []byte) error
- type FakeFile
- type Fakefileinfo
- type File
- type FileSystem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeFS ¶
type FakeFS struct {
// contains filtered or unexported fields
}
FakeFS implements FileSystem using a fake in-memory filesystem.
func MakeFakeFS ¶
func MakeFakeFS() *FakeFS
MakeFakeFS returns an instance of FakeFS with no files in it.
func (*FakeFS) ReadFile ¶
ReadFile always returns an empty bytes and error depending on content of m.
func (*FakeFS) ReadFiles ¶ added in v1.0.3
ReadFiles looks through all files in the fake filesystem and find the matching files and then read content from all of them
type FakeFile ¶
type FakeFile struct {
// contains filtered or unexported fields
}
FakeFile implements File in-memory for tests.
func (*FakeFile) ContentMatches ¶
ContentMatches returns true if v matches fake file's content.
func (*FakeFile) GetContent ¶
GetContent the content of a fake file.
type Fakefileinfo ¶
type Fakefileinfo struct {
*FakeFile
}
Fakefileinfo implements Fakefileinfo using a fake in-memory filesystem.
func (*Fakefileinfo) IsDir ¶
func (fi *Fakefileinfo) IsDir() bool
IsDir returns if it is a directory
func (*Fakefileinfo) ModTime ¶
func (fi *Fakefileinfo) ModTime() time.Time
ModTime returns the modification time
func (*Fakefileinfo) Sys ¶
func (fi *Fakefileinfo) Sys() interface{}
Sys should return underlying data source, but it now returns nil
type File ¶
type File interface { io.ReadWriteCloser Stat() (os.FileInfo, error) }
File groups the basic os.File methods.
type FileSystem ¶
type FileSystem interface { Create(name string) (File, error) Mkdir(name string, perm os.FileMode) error Open(name string) (File, error) Stat(name string) (os.FileInfo, error) ReadFile(name string) ([]byte, error) ReadFiles(name string) (map[string][]byte, error) WriteFile(name string, data []byte) error }
FileSystem groups basic os filesystem methods.