close file using existing style

This commit is contained in:
Dan Bent 2019-11-08 13:56:05 +13:00
parent 80fdcd65de
commit 310284f8d7

View File

@ -137,7 +137,6 @@ func GfmrunActionFunc(c *cli.Context) error {
if err != nil { if err != nil {
return err return err
} }
defer file.Close()
var counter int var counter int
scanner := bufio.NewScanner(file) scanner := bufio.NewScanner(file)
@ -147,6 +146,11 @@ func GfmrunActionFunc(c *cli.Context) error {
} }
} }
err = file.Close()
if err != nil {
return err
}
err = scanner.Err() err = scanner.Err()
if err != nil { if err != nil {
return err return err