Documentation
¶
Index ¶
- type FileSystem
- type MockFileInfo
- type MockFileSystem
- func (m *MockFileSystem) Create(name string) (*os.File, error)
- func (m *MockFileSystem) MkdirAll(path string, perm os.FileMode) error
- func (m *MockFileSystem) ReadFile(filename string) ([]byte, error)
- func (m *MockFileSystem) Stat(name string) (os.FileInfo, error)
- func (m *MockFileSystem) WriteFile(filename string, data []byte, perm os.FileMode) error
- type RealFileSystem
- func (rfs *RealFileSystem) Create(name string) (*os.File, error)
- func (rfs *RealFileSystem) MkdirAll(path string, perm os.FileMode) error
- func (rfs *RealFileSystem) ReadFile(filename string) ([]byte, error)
- func (rfs *RealFileSystem) Stat(name string) (os.FileInfo, error)
- func (rfs *RealFileSystem) WriteFile(filename string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem interface {
ReadFile(filename string) ([]byte, error)
WriteFile(filename string, data []byte, perm os.FileMode) error
Create(name string) (*os.File, error)
Stat(name string) (os.FileInfo, error)
MkdirAll(path string, perm os.FileMode) error
}
FileSystem interface defines the file operations we need
func NewFileSystem ¶
func NewFileSystem() FileSystem
NewFileSystem returns a new instance of RealFileSystem
type MockFileInfo ¶
type MockFileInfo struct {
NameFunc func() string
SizeFunc func() int64
ModeFunc func() os.FileMode
ModTimeFunc func() time.Time
IsDirFunc func() bool
SysFunc func() interface{}
}
MockFileInfo is a mock implementation of os.FileInfo
func (MockFileInfo) IsDir ¶
func (m MockFileInfo) IsDir() bool
func (MockFileInfo) ModTime ¶
func (m MockFileInfo) ModTime() time.Time
func (MockFileInfo) Mode ¶
func (m MockFileInfo) Mode() os.FileMode
func (MockFileInfo) Name ¶
func (m MockFileInfo) Name() string
func (MockFileInfo) Size ¶
func (m MockFileInfo) Size() int64
func (MockFileInfo) Sys ¶
func (m MockFileInfo) Sys() interface{}
type MockFileSystem ¶
type MockFileSystem struct {
ReadFileFunc func(filename string) ([]byte, error)
WriteFileFunc func(filename string, data []byte, perm os.FileMode) error
CreateFunc func(name string) (*os.File, error)
StatFunc func(name string) (os.FileInfo, error)
MkdirAllFunc func(path string, perm os.FileMode) error
}
MockFileSystem is a mock implementation of FileSystem
func (*MockFileSystem) MkdirAll ¶
func (m *MockFileSystem) MkdirAll(path string, perm os.FileMode) error
type RealFileSystem ¶
type RealFileSystem struct{}
RealFileSystem implements FileSystem using actual OS calls
func (*RealFileSystem) MkdirAll ¶
func (rfs *RealFileSystem) MkdirAll(path string, perm os.FileMode) error
Click to show internal directories.
Click to hide internal directories.