Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
update io.go code
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Nov 21, 2020
1 parent c21e6eb commit fff23e3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions io.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ func (da *Cedar) SaveToFile(fileName, dataType string) error {

out := bufio.NewWriter(file)
defer out.Flush()
da.Save(out, dataType)

return nil
return da.Save(out, dataType)
}

// Load loads the cedar from an io.Writer,
Expand All @@ -59,11 +57,11 @@ func (da *Cedar) Load(in io.Reader, dataType string) error {
// where dataType is either "json" or "gob".
func (da *Cedar) LoadFromFile(fileName, dataType string) error {
file, err := os.OpenFile(fileName, os.O_RDONLY, 0600)
defer file.Close()

if err != nil {
return err
}
defer file.Close()

in := bufio.NewReader(file)

return da.Load(in, dataType)
Expand Down

0 comments on commit fff23e3

Please sign in to comment.