feed.go: close twtxt file after creating it
This commit is contained in:
parent
536e49c8ac
commit
b6cb05902c
1 changed files with 5 additions and 1 deletions
6
feed.go
6
feed.go
|
@ -41,7 +41,11 @@ func prependToFile(filename, data string) error {
|
||||||
func Post(twt, feedFile string, ascend bool) error {
|
func Post(twt, feedFile string, ascend bool) error {
|
||||||
fileInfo, err := os.Stat(feedFile)
|
fileInfo, err := os.Stat(feedFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Create(feedFile)
|
f, err := os.Create(feedFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
f.Close()
|
||||||
} else if fileInfo.IsDir() {
|
} else if fileInfo.IsDir() {
|
||||||
return errors.New("Feed file is a directory")
|
return errors.New("Feed file is a directory")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue