Commit d17025fb by Torkel Ödegaard Committed by GitHub

Merge pull request #13631 from mjtrangoni/fix-megacheck-issues

Fix trivial megacheck issues
parents 7051a150 74533a7a
......@@ -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
}
......
......@@ -16,7 +16,6 @@ func TestUserAuth(t *testing.T) {
Convey("Given 5 users", t, func() {
var err error
var cmd *m.CreateUserCommand
users := []m.User{}
for i := 0; i < 5; i++ {
cmd = &m.CreateUserCommand{
Email: fmt.Sprint("user", i, "@test.com"),
......@@ -25,7 +24,6 @@ func TestUserAuth(t *testing.T) {
}
err = CreateUser(context.Background(), cmd)
So(err, ShouldBeNil)
users = append(users, cmd.Result)
}
Reset(func() {
......
......@@ -692,7 +692,7 @@ func TestMSSQL(t *testing.T) {
},
}
resp, err := endpoint.Query(nil, nil, query)
resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil)
queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil)
......
......@@ -769,7 +769,7 @@ func TestMySQL(t *testing.T) {
},
}
resp, err := endpoint.Query(nil, nil, query)
resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil)
queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil)
......
......@@ -701,7 +701,7 @@ func TestPostgres(t *testing.T) {
},
}
resp, err := endpoint.Query(nil, nil, query)
resp, err := endpoint.Query(context.Background(), nil, query)
So(err, ShouldBeNil)
queryResult := resp.Results["A"]
So(queryResult.Error, ShouldBeNil)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment