diff options
Diffstat (limited to 'hugofs/noop_fs.go')
-rw-r--r-- | hugofs/noop_fs.go | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/hugofs/noop_fs.go b/hugofs/noop_fs.go index 2d06622e4..c3d2f2da5 100644 --- a/hugofs/noop_fs.go +++ b/hugofs/noop_fs.go @@ -22,24 +22,27 @@ import ( ) var ( - noOpErr = errors.New("this is a filesystem that does nothing and this operation is not supported") + errNoOp = errors.New("this is a filesystem that does nothing and this operation is not supported") _ afero.Fs = (*noOpFs)(nil) - NoOpFs = &noOpFs{} + + // NoOpFs provides a no-op filesystem that implements the afero.Fs + // interface. + NoOpFs = &noOpFs{} ) type noOpFs struct { } func (fs noOpFs) Create(name string) (afero.File, error) { - return nil, noOpErr + return nil, errNoOp } func (fs noOpFs) Mkdir(name string, perm os.FileMode) error { - return noOpErr + return errNoOp } func (fs noOpFs) MkdirAll(path string, perm os.FileMode) error { - return noOpErr + return errNoOp } func (fs noOpFs) Open(name string) (afero.File, error) { @@ -51,15 +54,15 @@ func (fs noOpFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, } func (fs noOpFs) Remove(name string) error { - return noOpErr + return errNoOp } func (fs noOpFs) RemoveAll(path string) error { - return noOpErr + return errNoOp } func (fs noOpFs) Rename(oldname string, newname string) error { - return noOpErr + return errNoOp } func (fs noOpFs) Stat(name string) (os.FileInfo, error) { @@ -71,9 +74,9 @@ func (fs noOpFs) Name() string { } func (fs noOpFs) Chmod(name string, mode os.FileMode) error { - return noOpErr + return errNoOp } func (fs noOpFs) Chtimes(name string, atime time.Time, mtime time.Time) error { - return noOpErr + return errNoOp } |