Documentation ¶
Overview ¶
Package filesys contains abstractions and mocks of the file system, useful for testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Creator ¶
type Creator interface { // Create creates file `s` for writing. If the file already exists, it is truncated. Create(string) (io.WriteCloser, error) // WriteFile writes `data` to `file`. If the file doesn't exist, WriteFile creates it with `perm`. WriteFile(file string, data []byte, perm os.FileMode) error }
Creator abstracts file creation from the filesystem. Used for testing.
type MapFS ¶
MapFS is an in-memory implementation of FS, where all "files" are map entries, useful for testing.
func (MapFS) Create ¶
func (fs MapFS) Create(s string) (io.WriteCloser, error)
Create implements Creator.Create. To emulate the actual filesystem, writes to the returned WriteCloser are not visible until the WriteCloser is Close()d.
func (MapFS) Open ¶
func (fs MapFS) Open(s string) (io.ReadCloser, error)
Open returns a reader to a map entry. If the key `s` is not found, it returns an *os.PathError.
Click to show internal directories.
Click to hide internal directories.