Chore: a bit of spring cleaning (#16710)
* Chore: use early return technic everywhere And enable "indent-error-flow" revive rule * Chore: remove if-return rule from revive config * Chore: improve error messages And enable "error-strings" revive rule * Chore: enable "error-naming" revive rule * Chore: make linter happy * Chore: do not duplicate gofmt execution * Chore: make linter happy * Chore: address the pull review comments
This commit is contained in:
@@ -130,11 +130,11 @@ func NewRuleFromDBAlert(ruleDef *m.Alert) (*Rule, error) {
|
||||
if id, err := jsonModel.Get("id").Int64(); err == nil {
|
||||
model.Notifications = append(model.Notifications, fmt.Sprintf("%09d", id))
|
||||
} else {
|
||||
if uid, err := jsonModel.Get("uid").String(); err != nil {
|
||||
uid, err := jsonModel.Get("uid").String()
|
||||
if err != nil {
|
||||
return nil, ValidationError{Reason: "Neither id nor uid is specified, " + err.Error(), DashboardId: model.DashboardId, Alertid: model.Id, PanelId: model.PanelId}
|
||||
} else {
|
||||
model.Notifications = append(model.Notifications, uid)
|
||||
}
|
||||
model.Notifications = append(model.Notifications, uid)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user