From 33ecf3dc6b4d7243f2769b30fa2510397f42f04c Mon Sep 17 00:00:00 2001 From: Martin Bertschler Date: Thu, 5 Nov 2015 14:36:41 +0100 Subject: [PATCH] Add Sync() to the File interface, implement Sync() for InMemoryFile Sync() for InMemoryFile always returns nil. --- fs.go | 9 +++++---- memfile.go | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs.go b/fs.go index b1f1283..380b3ef 100644 --- a/fs.go +++ b/fs.go @@ -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. diff --git a/memfile.go b/memfile.go index 90a5ae0..6be5c87 100644 --- a/memfile.go +++ b/memfile.go @@ -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