Use SaveBlock api
This commit is contained in:
parent
764c67a707
commit
9184de2d1a
11
file.go
11
file.go
|
@ -467,19 +467,10 @@ func (fp* FilePages) saveBlocksFromPage(dirname string, page Page) error {
|
|||
}
|
||||
|
||||
for id, block := range blocks {
|
||||
log.Printf("Writing to %q\n", id)
|
||||
f, err := os.OpenFile(filepath.Join(dirname, BlocksDirectory, id), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
continue
|
||||
}
|
||||
enc := json.NewEncoder(f)
|
||||
enc.SetIndent("", " ")
|
||||
err = enc.Encode(&block)
|
||||
err := fp.blockRepo.SaveBlock(id, block)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
f.Close()
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue
Block a user