feed.go: close twtxt file after creating it
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmO9tiwACgkQO3+8IhRO Y5j0EA/8CH4lyh/Ua29qT54zrs+XuBDm2a3NGkkkYn+d5Q2LmVR60pskqwIPMJlp oAS1By+L/hrbCOgKd2qD/hyiz/1sWiBEIv5nGvW6Had8eS12P5MekvSSD5XoF/Ig us8RwGFrgcQcQGD1o0qGAbr77aJCfbYp4pzXVqza4abf/Vr5FWmagjxKiTZGri/U vK/HCfCCnSBt+XGaPmm67DjSxtejS3dUOaJaWY2Ia2t6PY2K7N0SdKUXBmx7YL9d n4cT6E4N1hlEQcZM1xporPcOyWV/lT/6LDbUjNyiny+YSePgIBl8F4NJD8uxnstS UapgjfPdaYixd79CEoWJqsNBpygqywNneS4eUFXUyVOV2mAa9yId0Xe05Ru/9Lyd e8uuBQRWd9iog99CsTsBayhH6iD0GK3XAVHppEo1aIumh405k3LWy9QNOxM7yUNh HSi+36q0mhB+jvNZAn4WgyRdrLNVjpbEsJFn9zLEyivTWFwYAOWOSN2s+aSEKCqs B1etUTkyxczMjaxe5HUE7rm7vK++1AqNnuuy2BhJ8wDHdPw6+YGMjU8WBxQ67GYq jUnrQl3aplG0w0NbUC2aY/m8diocxRDr0RAzABEFrahpFVYXYP5z6ZpzRsFbr8aZ Y70MPHpiR5La7cJOmel30W27FznGfcOVQH2A4XHzsvcl8Pa2hHM= =gumP -----END PGP SIGNATURE-----
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
feed.go
→
feed.go
@@ -41,7 +41,11 @@
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") }