Avoid leaving a file open for longer than necessary

This commit is contained in:
Andrew Ayer 2020-10-06 19:27:58 -04:00
parent 18b2d6d2a5
commit 2cccf67601
1 changed files with 1 additions and 1 deletions

View File

@ -221,8 +221,8 @@ func main() {
fmt.Fprintf(os.Stderr, "%s: %s: %s\n", os.Args[0], *watchlistFilename, err) fmt.Fprintf(os.Stderr, "%s: %s: %s\n", os.Args[0], *watchlistFilename, err)
os.Exit(1) os.Exit(1)
} }
defer file.Close()
watchlist, err = readWatchlist(file) watchlist, err = readWatchlist(file)
file.Close()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "%s: %s: %s\n", os.Args[0], *watchlistFilename, err) fmt.Fprintf(os.Stderr, "%s: %s: %s\n", os.Args[0], *watchlistFilename, err)
os.Exit(1) os.Exit(1)