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:
Oleg Gaidarenko
2019-04-23 11:24:47 +03:00
committed by GitHub
parent 5ce5840ae0
commit 54c1bf0cc9
21 changed files with 65 additions and 74 deletions

View File

@@ -213,11 +213,12 @@ func getAlertNotificationWithUidInternal(query *m.GetAlertNotificationsWithUidQu
func CreateAlertNotificationCommand(cmd *m.CreateAlertNotificationCommand) error {
return inTransaction(func(sess *DBSession) error {
if cmd.Uid == "" {
if uid, uidGenerationErr := generateNewAlertNotificationUid(sess, cmd.OrgId); uidGenerationErr != nil {
uid, uidGenerationErr := generateNewAlertNotificationUid(sess, cmd.OrgId)
if uidGenerationErr != nil {
return uidGenerationErr
} else {
cmd.Uid = uid
}
cmd.Uid = uid
}
existingQuery := &m.GetAlertNotificationsWithUidQuery{OrgId: cmd.OrgId, Uid: cmd.Uid}
err := getAlertNotificationWithUidInternal(existingQuery, sess)