diff options
Diffstat (limited to 'storage')
-rw-r--r-- | storage/filesystem/index.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/storage/filesystem/index.go b/storage/filesystem/index.go index d04195c..be800ef 100644 --- a/storage/filesystem/index.go +++ b/storage/filesystem/index.go @@ -20,8 +20,14 @@ func (s *IndexStorage) SetIndex(idx *index.Index) (err error) { } defer ioutil.CheckClose(f, &err) + bw := bufio.NewWriter(f) + defer func() { + if e := bw.Flush(); err == nil && e != nil { + err = e + } + }() - e := index.NewEncoder(f) + e := index.NewEncoder(bw) err = e.Encode(idx) return err } |