Chore: Enable Go linter gocritic (#26224)

* Chore: Enable gocritic linter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-07-16 14:39:01 +02:00
committed by GitHub
parent 317c7b269c
commit d4e4cb4c71
43 changed files with 184 additions and 171 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ func formatShort(interval time.Duration) string {
result += fmt.Sprintf("%dm", mins)
}
remaining = remaining - (mins * time.Minute)
remaining -= (mins * time.Minute)
seconds := remaining / time.Second
if seconds > 0 {
result += fmt.Sprintf("%ds", seconds)
+3 -7
View File
@@ -12,6 +12,8 @@ import (
"github.com/grafana/grafana/pkg/setting"
)
var regNonAlphaNumeric = regexp.MustCompile("[^a-zA-Z0-9]+")
type AnyId struct {
Id int64 `json:"id"`
}
@@ -73,13 +75,7 @@ func GetGravatarUrlWithDefault(text string, defaultText string) string {
return GetGravatarUrl(text)
}
reg, err := regexp.Compile("[^a-zA-Z0-9]+")
if err != nil {
return ""
}
text = reg.ReplaceAllString(defaultText, "") + "@localhost"
text = regNonAlphaNumeric.ReplaceAllString(defaultText, "") + "@localhost"
return GetGravatarUrl(text)
}