Add defer logFile.Close()

This commit is contained in:
Gary Talent 2017-01-27 19:52:58 -06:00
parent 42e65ebf52
commit 0a2bc38196

View File

@ -51,6 +51,7 @@ func runServer(opts cmdOptions) {
if opts.logFile != "stdout" {
logFile, err := os.OpenFile(opts.logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0664)
if err == nil {
defer logFile.Close()
log.SetOutput(logFile)
} else {
log.Print("Could not open log file: ", err)