MM-31064: Simplify indentation (#16565)
* 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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7419898449
Коммит
1a131b54af
@@ -392,17 +392,17 @@ func (s *LocalCacheStore) doStandardAddToCache(cache cache.Cache, key string, va
|
||||
}
|
||||
|
||||
func (s *LocalCacheStore) doStandardReadCache(cache cache.Cache, key string, value interface{}) error {
|
||||
if err := cache.Get(key, value); err == nil {
|
||||
err := cache.Get(key, value)
|
||||
if err == nil {
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheHitCounter(cache.Name())
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheMissCounter(cache.Name())
|
||||
}
|
||||
return err
|
||||
}
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheMissCounter(cache.Name())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *LocalCacheStore) doClearCacheCluster(cache cache.Cache) {
|
||||
|
||||
@@ -120,9 +120,8 @@ func (ps SqlPluginStore) CompareAndSet(kv *model.PluginKeyValue, oldValue []byte
|
||||
// need to return it.
|
||||
if IsUniqueConstraintError(err, []string{"PRIMARY", "PluginId", "Key", "PKey", "pkey"}) {
|
||||
return false, nil
|
||||
} else {
|
||||
return false, errors.Wrap(err, "failed to insert PluginKeyValue")
|
||||
}
|
||||
return false, errors.Wrap(err, "failed to insert PluginKeyValue")
|
||||
}
|
||||
} else {
|
||||
currentTime := model.GetMillis()
|
||||
|
||||
@@ -292,16 +292,16 @@ func (me SqlSessionStore) Cleanup(expiryTime int64, batchSize int64) {
|
||||
var rowsAffected int64 = 1
|
||||
|
||||
for rowsAffected > 0 {
|
||||
if sqlResult, err := me.GetMaster().Exec(query, map[string]interface{}{"ExpiresAt": expiryTime, "Limit": batchSize}); err != nil {
|
||||
sqlResult, err := me.GetMaster().Exec(query, map[string]interface{}{"ExpiresAt": expiryTime, "Limit": batchSize})
|
||||
if err != nil {
|
||||
mlog.Error("Unable to cleanup session store.", mlog.Err(err))
|
||||
return
|
||||
}
|
||||
var rowErr error
|
||||
rowsAffected, rowErr = sqlResult.RowsAffected()
|
||||
if rowErr != nil {
|
||||
mlog.Error("Unable to cleanup session store.", mlog.Err(err))
|
||||
return
|
||||
} else {
|
||||
var rowErr error
|
||||
rowsAffected, rowErr = sqlResult.RowsAffected()
|
||||
if rowErr != nil {
|
||||
mlog.Error("Unable to cleanup session store.", mlog.Err(err))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(SESSIONS_CLEANUP_DELAY_MILLISECONDS * time.Millisecond)
|
||||
|
||||
@@ -518,9 +518,8 @@ func applyMultiRoleFilters(query sq.SelectBuilder, systemRoles []string, teamRol
|
||||
|
||||
if len(sqOr) > 0 {
|
||||
return query.Where(sqOr)
|
||||
} else {
|
||||
return query
|
||||
}
|
||||
return query
|
||||
}
|
||||
|
||||
func applyChannelGroupConstrainedFilter(query sq.SelectBuilder, channelId string) sq.SelectBuilder {
|
||||
|
||||
@@ -728,9 +728,8 @@ func testPluginSetWithOptions(t *testing.T, ss store.Store, s SqlStore) {
|
||||
ok, err := ss.Plugin().SetWithOptions(kv.PluginId, kv.Key, kv.Value, options)
|
||||
if !ok {
|
||||
return nil, err
|
||||
} else {
|
||||
return kv, err
|
||||
}
|
||||
return kv, err
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -29,9 +29,8 @@ const (
|
||||
func getEnv(name, defaultValue string) string {
|
||||
if value := os.Getenv(name); value != "" {
|
||||
return value
|
||||
} else {
|
||||
return defaultValue
|
||||
}
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
func log(message string) {
|
||||
|
||||
Ссылка в новой задаче
Block a user