From b6cb05902c64b311b2ad17a09b8a1ac6dc4fb4e1 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Tue, 10 Jan 2023 12:02:04 -0700 Subject: [PATCH] feed.go: close twtxt file after creating it --- feed.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/feed.go b/feed.go index 55cf66e..2bc0089 100644 --- a/feed.go +++ b/feed.go @@ -41,7 +41,11 @@ func prependToFile(filename, data string) error { func Post(twt, feedFile string, ascend bool) error { fileInfo, err := os.Stat(feedFile) if err != nil { - os.Create(feedFile) + f, err := os.Create(feedFile) + if err != nil { + return err + } + f.Close() } else if fileInfo.IsDir() { return errors.New("Feed file is a directory") }