Fix gosimple issues (#17179)

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
pull/17189/head
Mario Trangoni 6 years ago committed by Carl Bergquist
parent 7e3ac4ebde
commit 66ba2aa524
  1. 14
      pkg/middleware/auth_proxy/auth_proxy.go
  2. 2
      pkg/services/alerting/notifiers/discord.go
  3. 2
      pkg/services/alerting/notifiers/victorops.go
  4. 2
      pkg/services/sqlstore/login_attempt.go
  5. 1
      scripts/backend-lint.sh

@ -64,7 +64,7 @@ func newError(message string, err error) *Error {
// Error returns a Error error string
func (err *Error) Error() string {
return fmt.Sprintf("%s", err.Message)
return err.Message
}
// Options for the AuthProxy
@ -98,20 +98,12 @@ func New(options *Options) *AuthProxy {
func (auth *AuthProxy) IsEnabled() bool {
// Bail if the setting is not enabled
if !auth.enabled {
return false
}
return true
return auth.enabled
}
// HasHeader checks if the we have specified header
func (auth *AuthProxy) HasHeader() bool {
if len(auth.header) == 0 {
return false
}
return true
return len(auth.header) != 0
}
// IsAllowedIP compares presented IP with the whitelist one

@ -171,7 +171,7 @@ func (this *DiscordNotifier) embedImage(cmd *models.SendWebhookSync, imagePath s
w.Close()
cmd.Body = string(b.Bytes())
cmd.Body = b.String()
cmd.ContentType = w.FormDataContentType()
return nil

@ -92,7 +92,7 @@ func (vn *VictoropsNotifier) Notify(evalContext *alerting.EvalContext) error {
messageType = alertStateRecovery
}
fields := make(map[string]interface{}, 0)
fields := make(map[string]interface{})
fieldLimitCount := 4
for index, evt := range evalContext.EvalMatches {
fields[evt.Metric] = evt.Value

@ -43,7 +43,7 @@ func DeleteOldLoginAttempts(cmd *m.DeleteOldLoginAttemptsCommand) error {
if err != nil {
return err
}
// nolint: gosimple
if result == nil || len(result) == 0 || result[0] == nil {
return nil
}

@ -27,6 +27,7 @@ exit_if_fail gometalinter --enable-gc --vendor --deadline 10m --disable-all \
exit_if_fail golangci-lint run --deadline 10m --disable-all \
--enable=deadcode\
--enable=gofmt\
--enable=gosimple\
--enable=ineffassign\
--enable=structcheck\
--enable=unconvert\

Loading…
Cancel
Save