Documentation ¶
Index ¶
- Variables
- func ValidateLabel(label string) error
- type FilesystemIO
- func (*FilesystemIO) Exists(path string) (bool, error)
- func (f *FilesystemIO) MakeDir(dirname string, mode os.FileMode) error
- func (f *FilesystemIO) ReadDir(dirname string) ([]os.FileInfo, error)
- func (f *FilesystemIO) ReadFile(filename string) ([]byte, error)
- func (f *FilesystemIO) Remove(name string) error
- func (f *FilesystemIO) WriteFile(path, name string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
var LabelRegexp = regexp.MustCompile(`^[[:alnum:]][[:alnum:]_.+-]*$`)
LabelRegexp is the regular expression controlling the allowed characters for the package label.
Functions ¶
func ValidateLabel ¶
ValidateLabel return an error if the provided label contains any invalid characters, as determined by LabelRegexp.
Types ¶
type FilesystemIO ¶
type FilesystemIO struct { }
FilesystemIO is the production implementation of the IOWriter interface
func (*FilesystemIO) Exists ¶
func (*FilesystemIO) Exists(path string) (bool, error)
Exists checks whether a file exists
func (*FilesystemIO) MakeDir ¶
func (f *FilesystemIO) MakeDir(dirname string, mode os.FileMode) error
MakeDir makes a directory on the filesystem (and any necessary parent directories).
func (*FilesystemIO) ReadDir ¶
func (f *FilesystemIO) ReadDir(dirname string) ([]os.FileInfo, error)
ReadDir reads a directory from the filesystem
func (*FilesystemIO) ReadFile ¶
func (f *FilesystemIO) ReadFile(filename string) ([]byte, error)
ReadFile reads a file from the filesystem
func (*FilesystemIO) Remove ¶
func (f *FilesystemIO) Remove(name string) error
Remove removes a file from the filesystem - used for rolling back an in-flight Save operation upon a failure
func (*FilesystemIO) WriteFile ¶
func (f *FilesystemIO) WriteFile(path, name string, data []byte) error
WriteFile writes a file to the filesystem; it does so atomically by first writing to a temp file and then renaming the file so that if the operation crashes midway we're not stuck with a bad package