From 685c6ae15f4e68c1c1f2fca4f33e5f1d2826c391 Mon Sep 17 00:00:00 2001 From: Kato Twofold Date: Wed, 1 Jun 2022 18:10:10 +0300 Subject: [PATCH] * Optimization ( Thanks Tecchie088 ) --- lib/objects/objects_post.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/objects/objects_post.go b/lib/objects/objects_post.go index ee69f5a..b66518b 100644 --- a/lib/objects/objects_post.go +++ b/lib/objects/objects_post.go @@ -233,8 +233,6 @@ func WritePost(p Post) error { if err != nil { return err } - // Actually close the file - defer f.Close() // Write the contnets _, err = f.WriteString(p.Content) @@ -242,11 +240,7 @@ func WritePost(p Post) error { return err } - if err := f.Close(); err != nil { - return err - } - - return nil + return f.Close() } // Cleanup all of the older posts based on the environment settings