feed.go: close twtxt file after creating it

This commit is contained in:
Iris Lightshard 2023-01-10 12:02:04 -07:00
parent 536e49c8ac
commit b6cb05902c
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -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")
}