From 7defbcb1d9ed71d09c9f987ffa3df2f3e398e19a Mon Sep 17 00:00:00 2001 From: siddharth Date: Sun, 28 Nov 2021 21:48:22 -0500 Subject: db: update FernDB.Write Always truncate file before writing. --- db/db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db/db.go') 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 } -- cgit v1.2.3