Linter: fix linter for golangci-lint version v1.45.0 (#47623)

* Update golangci-lint to v1.45.2

Version 1.45.0 added support for Go 1.18:

https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md#v1450

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>

* Linter: fix some lints issue for golangci-lint version 1.45.2

Co-authored-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
ying-jeanne 2022-04-12 14:15:16 +02:00 committed by GitHub
parent 98cbecc4a5
commit e979690011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -553,7 +553,7 @@ func (hs *HTTPServer) PauseAlert(c *models.ReqContext) response.Response {
return response.Error(500, "", err)
}
var resp models.AlertStateType = models.AlertStateUnknown
resp := models.AlertStateUnknown
pausedState := "un-paused"
if cmd.Paused {
resp = models.AlertStatePaused
@ -579,7 +579,7 @@ func (hs *HTTPServer) PauseAllAlerts(c *models.ReqContext) response.Response {
return response.Error(500, "Failed to pause alerts", err)
}
var resp models.AlertStateType = models.AlertStatePending
resp := models.AlertStatePending
pausedState := "un paused"
if updateCmd.Paused {
resp = models.AlertStatePaused

View File

@ -29,7 +29,8 @@ import (
const (
InvalidUsernamePassword = "invalid username or password"
InvalidAPIKey = "invalid API key"
/* #nosec */
InvalidAPIKey = "invalid API key"
)
const ServiceName = "ContextHandler"

View File

@ -49,7 +49,7 @@ func TestReadDashboard(t *testing.T) {
require.NoError(t, err)
update := false
savedPath := "testdata/" + input + "-info.json"
savedPath := filepath.Join("testdata/", input+"-info.json")
saved, err := os.ReadFile(savedPath)
if err != nil {
update = true