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
parent 403132f4e3
commit 355a71125c
2 changed files with 9 additions and 4 deletions

9
fs.go
View File

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

View File

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