Chore: Enable exhaustive linter (#29458)

* Chore: Enable exhaustive linter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-12-01 09:53:27 +01:00
committed by GitHub
parent cbb2c0a5d8
commit f55818ca70
16 changed files with 37 additions and 16 deletions
+5 -5
View File
@@ -232,7 +232,6 @@ func verifyExistingOrg(sess *DBSession, orgId int64) error {
func getOrCreateOrg(sess *DBSession, orgName string) (int64, error) {
var org models.Org
if setting.AutoAssignOrg {
has, err := sess.Where("id=?", setting.AutoAssignOrgId).Get(&org)
if err != nil {
@@ -241,15 +240,16 @@ func getOrCreateOrg(sess *DBSession, orgName string) (int64, error) {
if has {
return org.Id, nil
}
if setting.AutoAssignOrgId == 1 {
org.Name = mainOrgName
org.Id = int64(setting.AutoAssignOrgId)
} else {
if setting.AutoAssignOrgId != 1 {
sqlog.Error("Could not create user: organization ID does not exist", "orgID",
setting.AutoAssignOrgId)
return 0, fmt.Errorf("could not create user: organization ID %d does not exist",
setting.AutoAssignOrgId)
}
org.Name = mainOrgName
org.Id = int64(setting.AutoAssignOrgId)
} else {
org.Name = orgName
}