* MM-31064: Simplify indentation

Reduce indentation where possible.

```release-note
NONE
```

Command ran to verify:
golangci-lint run --disable-all --enable golint --max-issues-per-linter=10000 --max-same-issues=100000 ./... | grep "block ends with a return state"

https://mattermost.atlassian.net/browse/MM-31064

* incorporate review comments

* enable golint for outdent rule

* fix remaining issues

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-12-21 21:20:47 +05:30
коммит произвёл GitHub
родитель 7419898449
Коммит 1a131b54af
61 изменённых файлов: 323 добавлений и 380 удалений

Просмотреть файл

@@ -71,33 +71,33 @@ func (worker *Worker) runAdvancedPermissionsPhase2Migration(lastDone string) (bo
if progress.CurrentTable == "TeamMembers" {
// Run a TeamMembers migration batch.
if result, err := worker.srv.Store.Team().MigrateTeamMembers(progress.LastTeamId, progress.LastUserId); err != nil {
result, err := worker.srv.Store.Team().MigrateTeamMembers(progress.LastTeamId, progress.LastUserId)
if err != nil {
return false, progress.ToJson(), model.NewAppError("MigrationsWorker.runAdvancedPermissionsPhase2Migration", "app.team.migrate_team_members.update.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
if result == nil {
// We haven't progressed. That means that we've reached the end of this stage of the migration, and should now advance to the next stage.
progress.LastUserId = strings.Repeat("0", 26)
progress.CurrentTable = "ChannelMembers"
return false, progress.ToJson(), nil
}
progress.LastTeamId = result["TeamId"]
progress.LastUserId = result["UserId"]
}
if result == nil {
// We haven't progressed. That means that we've reached the end of this stage of the migration, and should now advance to the next stage.
progress.LastUserId = strings.Repeat("0", 26)
progress.CurrentTable = "ChannelMembers"
return false, progress.ToJson(), nil
}
progress.LastTeamId = result["TeamId"]
progress.LastUserId = result["UserId"]
} else if progress.CurrentTable == "ChannelMembers" {
// Run a ChannelMembers migration batch.
if data, err := worker.srv.Store.Channel().MigrateChannelMembers(progress.LastChannelId, progress.LastUserId); err != nil {
data, err := worker.srv.Store.Channel().MigrateChannelMembers(progress.LastChannelId, progress.LastUserId)
if err != nil {
return false, progress.ToJson(), model.NewAppError("MigrationsWorker.runAdvancedPermissionsPhase2Migration", "app.channel.migrate_channel_members.select.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
if data == nil {
// We haven't progressed. That means we've reached the end of this final stage of the migration.
return true, progress.ToJson(), nil
}
progress.LastChannelId = data["ChannelId"]
progress.LastUserId = data["UserId"]
}
if data == nil {
// We haven't progressed. That means we've reached the end of this final stage of the migration.
return true, progress.ToJson(), nil
}
progress.LastChannelId = data["ChannelId"]
progress.LastUserId = data["UserId"]
}
return false, progress.ToJson(), nil

Просмотреть файл

@@ -102,9 +102,9 @@ func (scheduler *Scheduler) createJob(migrationKey string, lastJob *model.Job, s
JOB_DATA_KEY_MIGRATION_LAST_DONE: lastDone,
}
if job, err := scheduler.srv.Jobs.CreateJob(model.JOB_TYPE_MIGRATIONS, data); err != nil {
job, err := scheduler.srv.Jobs.CreateJob(model.JOB_TYPE_MIGRATIONS, data)
if err != nil {
return nil, err
} else {
return job, nil
}
return job, nil
}