mirror of
https://github.com/grafana/grafana.git
synced 2025-01-21 22:13:38 -06:00
pkg/services/alerting/notifiers/telegram.go: check error before close.
See,
$ gometalinter --vendor --deadline 6m --disable-all --enable=megacheck ./...
pkg/services/alerting/notifiers/telegram.go:130:2⚠️ should check returned error before deferring imageFile.Close() (SA5001) (megacheck)
This commit is contained in:
parent
18e127db2a
commit
9c44c75936
@ -127,7 +127,13 @@ func (this *TelegramNotifier) buildMessageInlineImage(evalContext *alerting.Eval
|
||||
var err error
|
||||
|
||||
imageFile, err = os.Open(evalContext.ImageOnDiskPath)
|
||||
defer imageFile.Close()
|
||||
defer func() {
|
||||
err := imageFile.Close()
|
||||
if err != nil {
|
||||
log.Error2("Could not close Telegram inline image.", "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user