Skip to content

Commit

Permalink
Avoid bad search file JSON writes
Browse files Browse the repository at this point in the history
  • Loading branch information
gsamokovarov committed Feb 19, 2016
1 parent 2030510 commit ee465db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions config/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func (c *Config) WriteSearch(term string, index int) error {
return err
}

_, ferr := searchFile.Write(jsonContent)
return ferr
if err := searchFile.Truncate(0); err != nil {
return err
}

_, err = searchFile.Write(jsonContent)
return err
}

0 comments on commit ee465db

Please sign in to comment.