summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-11-28 21:48:22 -0500
committersiddharth <s@ricketyspace.net>2021-11-28 21:48:22 -0500
commit7defbcb1d9ed71d09c9f987ffa3df2f3e398e19a (patch)
tree2a4d09800ad6c0606f74a0e8dcbb9487b923cfff
parent88c18f5fab00d9caf809c28f980e6603d2959311 (diff)
db: update FernDB.Write
Always truncate file before writing.
-rw-r--r--db/db.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/db.go b/db/db.go
index 4ee511b..05baf07 100644
--- a/db/db.go
+++ b/db/db.go
@@ -102,7 +102,7 @@ func (fdb *FernDB) Write() error {
return fmt.Errorf("FernDB path not set")
}
- f, err := os.OpenFile(dbPath, os.O_WRONLY|os.O_CREATE, 0644)
+ f, err := os.OpenFile(dbPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}