File represents a file object.
type File interface { io.Reader io.Closer io.Writer io.ReaderAt io.Seeker Name() string Readdir(int) ([]os.FileInfo, error) Stat() (os.FileInfo, error) }
Filesystem is a filesystem implementation.
type Filesystem interface { Mkdir(name string, perm os.FileMode) error MkdirAll(path string, perm os.FileMode) error Open(string) (File, error) Create(string) (File, error) Stat(string) (os.FileInfo, error) TempFile(dir, pattern string) (File, error) Rename(oldpath, newpath string) error Remove(name string) error Link(oldname, newname string) error }
func Default() Filesystem
Default returns the default filesystem implementation.
MockFS allows mocking a filesystem.
type MockFS struct { MkdirFunc func(string, os.FileMode) error MkdirAllFunc func(string, os.FileMode) error CreateFunc func(string) (File, error) OpenFunc func(string) (File, error) StatFunc func(string) (os.FileInfo, error) TempFileFunc func(string, string) (File, error) RenameFunc func(string, string) error RemoveFunc func(string) error LinkFunc func(string, string) error }
func (fs *MockFS) Create(name string) (File, error)
Create calls fs.CreateFunc
func (fs *MockFS) Link(oldname, newname string) error
Link calls fs.LinkFunc
func (fs *MockFS) Mkdir(name string, perm os.FileMode) error
Mkdir calls fs.MkdirFunc
func (fs *MockFS) MkdirAll(path string, perm os.FileMode) error
MkdirAll calls fs.MkdirAllFunc
func (fs *MockFS) Open(name string) (File, error)
Open calls fs.OpenFunc
func (fs *MockFS) Remove(name string) error
Remove calls fs.RemoveFunc
func (fs *MockFS) Rename(oldpath, newpath string) error
Rename calls fs.RenameFunc
func (fs *MockFS) Stat(name string) (os.FileInfo, error)
Stat calls fs.StatFunc
func (fs *MockFS) TempFile(dir, pattern string) (File, error)
TempFile calls fs.TempFileFunc