Add defer logFile.Close()
This commit is contained in:
parent
42e65ebf52
commit
0a2bc38196
@ -51,6 +51,7 @@ func runServer(opts cmdOptions) {
|
|||||||
if opts.logFile != "stdout" {
|
if opts.logFile != "stdout" {
|
||||||
logFile, err := os.OpenFile(opts.logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0664)
|
logFile, err := os.OpenFile(opts.logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0664)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
defer logFile.Close()
|
||||||
log.SetOutput(logFile)
|
log.SetOutput(logFile)
|
||||||
} else {
|
} else {
|
||||||
log.Print("Could not open log file: ", err)
|
log.Print("Could not open log file: ", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user