Add Sync() to the File interface, implement Sync() for InMemoryFile

Sync() for InMemoryFile always returns nil.
This commit is contained in:
Martin Bertschler 2015-11-05 14:36:41 +01:00 committed by spf13
parent aca753daff
commit 33ecf3dc6b
2 changed files with 9 additions and 4 deletions

9
fs.go
View File

@ -39,13 +39,14 @@ type File interface {
io.Seeker io.Seeker
io.Writer io.Writer
io.WriterAt io.WriterAt
//Fd() uintptr
Stat() (os.FileInfo, error) Name() string
Readdir(count int) ([]os.FileInfo, error) Readdir(count int) ([]os.FileInfo, error)
Readdirnames(n int) ([]string, error) Readdirnames(n int) ([]string, error)
WriteString(s string) (ret int, err error) Stat() (os.FileInfo, error)
Sync() error
Truncate(size int64) error Truncate(size int64) error
Name() string WriteString(s string) (ret int, err error)
} }
// Fs is the filesystem interface. // Fs is the filesystem interface.

View File

@ -74,6 +74,10 @@ func (f *InMemoryFile) Stat() (os.FileInfo, error) {
return &InMemoryFileInfo{f}, nil return &InMemoryFileInfo{f}, nil
} }
func (f *InMemoryFile) Sync() error {
return nil
}
func (f *InMemoryFile) Readdir(count int) (res []os.FileInfo, err error) { func (f *InMemoryFile) Readdir(count int) (res []os.FileInfo, err error) {
var outLength int64 var outLength int64