-
Notifications
You must be signed in to change notification settings - Fork 6
/
emptyfs.go
36 lines (33 loc) · 2.37 KB
/
emptyfs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package vfs
import (
"io/fs"
"os"
"time"
)
// An EmptyFS is a VFS that does not contain any files.
type EmptyFS struct{}
func (EmptyFS) Chmod(name string, mode fs.FileMode) error { return os.ErrNotExist }
func (EmptyFS) Chown(name string, uid, git int) error { return os.ErrNotExist }
func (EmptyFS) Chtimes(name string, atime, mtime time.Time) error { return os.ErrNotExist }
func (EmptyFS) Create(name string) (*os.File, error) { return nil, os.ErrNotExist }
func (EmptyFS) Glob(pattern string) ([]string, error) { return nil, os.ErrNotExist }
func (EmptyFS) Lchown(name string, uid, git int) error { return os.ErrNotExist }
func (EmptyFS) Link(oldname, newname string) error { return os.ErrNotExist }
func (EmptyFS) Lstat(name string) (fs.FileInfo, error) { return nil, os.ErrNotExist }
func (EmptyFS) Mkdir(name string, perm fs.FileMode) error { return os.ErrNotExist }
func (EmptyFS) Open(name string) (fs.File, error) { return nil, os.ErrNotExist }
func (EmptyFS) OpenFile(name string, flag int, perm fs.FileMode) (*os.File, error) {
return nil, os.ErrNotExist
}
func (EmptyFS) PathSeparator() rune { return '/' }
func (EmptyFS) RawPath(name string) (string, error) { return name, nil }
func (EmptyFS) ReadDir(dirname string) ([]fs.DirEntry, error) { return nil, os.ErrNotExist }
func (EmptyFS) ReadFile(filename string) ([]byte, error) { return nil, os.ErrNotExist }
func (EmptyFS) Readlink(name string) (string, error) { return "", os.ErrNotExist }
func (EmptyFS) Remove(name string) error { return nil }
func (EmptyFS) RemoveAll(name string) error { return nil }
func (EmptyFS) Rename(oldpath, newpath string) error { return os.ErrNotExist }
func (EmptyFS) Stat(name string) (fs.FileInfo, error) { return nil, os.ErrNotExist }
func (EmptyFS) Symlink(oldname, newname string) error { return os.ErrNotExist }
func (EmptyFS) Truncate(name string, size int64) error { return os.ErrNotExist }
func (EmptyFS) WriteFile(filename string, data []byte, perm fs.FileMode) error { return os.ErrNotExist }