Chore: Fix issues reported by staticcheck; enable stylecheck linter (#28866)
* Chore: Fix issues reported by staticcheck Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Apply suggestions from code review Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
co-authored by
Emil Tullstedt
parent
135b83e17f
commit
676d393ec9
+7
-7
@@ -89,12 +89,12 @@ type Alert struct {
|
||||
Settings *simplejson.Json
|
||||
}
|
||||
|
||||
func (alert *Alert) ValidToSave() bool {
|
||||
return alert.DashboardId != 0 && alert.OrgId != 0 && alert.PanelId != 0
|
||||
func (a *Alert) ValidToSave() bool {
|
||||
return a.DashboardId != 0 && a.OrgId != 0 && a.PanelId != 0
|
||||
}
|
||||
|
||||
func (alert *Alert) ShouldUpdateState(newState AlertStateType) bool {
|
||||
return alert.State != newState
|
||||
func (a *Alert) ShouldUpdateState(newState AlertStateType) bool {
|
||||
return a.State != newState
|
||||
}
|
||||
|
||||
func (a *Alert) ContainsUpdates(other *Alert) bool {
|
||||
@@ -117,10 +117,10 @@ func (a *Alert) ContainsUpdates(other *Alert) bool {
|
||||
return result
|
||||
}
|
||||
|
||||
func (alert *Alert) GetTagsFromSettings() []*Tag {
|
||||
func (a *Alert) GetTagsFromSettings() []*Tag {
|
||||
tags := []*Tag{}
|
||||
if alert.Settings != nil {
|
||||
if data, ok := alert.Settings.CheckGet("alertRuleTags"); ok {
|
||||
if a.Settings != nil {
|
||||
if data, ok := a.Settings.CheckGet("alertRuleTags"); ok {
|
||||
for tagNameString, tagValue := range data.MustMap() {
|
||||
// MustMap() already guarantees the return of a `map[string]interface{}`.
|
||||
// Therefore we only need to verify that tagValue is a String.
|
||||
|
||||
Reference in New Issue
Block a user