Adjust govet settings and fix issues found by it (#12947)

Этот коммит содержится в:
Ben Schumacher
2019-11-04 13:47:59 +01:00
коммит произвёл GitHub
родитель 3a1deeaac5
Коммит 812c40a307
11 изменённых файлов: 37 добавлений и 38 удалений

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

@@ -138,8 +138,10 @@ func (a *App) ensurePostActionCookieSecret() error {
return err
}
system.Value = string(v)
if err = a.Srv.Store.System().Save(system); err == nil {
// If we were able to save the key, use it, otherwise ignore the error.
// If we were able to save the key, use it, otherwise log the error.
if appErr := a.Srv.Store.System().Save(system); appErr != nil {
mlog.Error("Failed to save PostActionCookieSecret", mlog.Err(appErr))
} else {
secret = newSecret
}
}
@@ -199,8 +201,10 @@ func (a *App) ensureAsymmetricSigningKey() error {
return err
}
system.Value = string(v)
if err = a.Srv.Store.System().Save(system); err == nil {
// If we were able to save the key, use it, otherwise ignore the error.
// If we were able to save the key, use it, otherwise log the error.
if appErr := a.Srv.Store.System().Save(system); appErr != nil {
mlog.Error("Failed to save AsymmetricSigningKey", mlog.Err(appErr))
} else {
key = newKey
}
}

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

@@ -72,8 +72,7 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) {
return nil, model.NewAppError("GetSession", "api.context.invalid_token.error", map[string]interface{}{"Token": token}, "", http.StatusUnauthorized)
}
if session != nil &&
*a.Config().ServiceSettings.SessionIdleTimeoutInMinutes > 0 &&
if *a.Config().ServiceSettings.SessionIdleTimeoutInMinutes > 0 &&
!session.IsOAuth &&
session.Props[model.SESSION_PROP_TYPE] != model.SESSION_TYPE_USER_ACCESS_TOKEN {