make vet happy: 'don't leak contexts'

This commit is contained in:
Christian Schwarz 2017-09-30 16:39:52 +02:00
parent 8934d7cb64
commit 45670a7e5d
2 changed files with 4 additions and 1 deletions

View File

@ -103,6 +103,7 @@ outer:
} }
signal.Stop(sigChan) signal.Stop(sigChan)
cancel() // make go vet happy
log.Info("exiting") log.Info("exiting")

View File

@ -41,7 +41,7 @@ func (l *Logger) log(level Level, msg string) {
entry := Entry{level, msg, time.Now(), l.fields} entry := Entry{level, msg, time.Now(), l.fields}
ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(l.outletTimeout)) ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(l.outletTimeout))
ech := make(chan error) ech := make(chan error)
louts := l.outlets[level] louts := l.outlets[level]
@ -64,6 +64,8 @@ func (l *Logger) log(level Level, msg string) {
} }
} }
cancel() // make go vet happy
} }
func (l *Logger) WithField(field string, val interface{}) *Logger { func (l *Logger) WithField(field string, val interface{}) *Logger {