Run ineffassign against codebase (#12925)
Этот коммит содержится в:
коммит произвёл
Daniel Schalla
родитель
4cc2973483
Коммит
38c0bde7f8
@@ -2507,6 +2507,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
|||||||
// Setup the system administrator to listen for websocket events from the channels.
|
// Setup the system administrator to listen for websocket events from the channels.
|
||||||
th.LinkUserToTeam(th.SystemAdminUser, th.BasicTeam)
|
th.LinkUserToTeam(th.SystemAdminUser, th.BasicTeam)
|
||||||
_, err := th.App.AddUserToChannel(th.SystemAdminUser, th.BasicChannel)
|
_, err := th.App.AddUserToChannel(th.SystemAdminUser, th.BasicChannel)
|
||||||
|
require.Nil(t, err)
|
||||||
_, err = th.App.AddUserToChannel(th.SystemAdminUser, th.BasicChannel2)
|
_, err = th.App.AddUserToChannel(th.SystemAdminUser, th.BasicChannel2)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
props := map[string]string{}
|
props := map[string]string{}
|
||||||
|
|||||||
@@ -95,9 +95,9 @@ func (a *App) DoEmojisPermissionsMigration() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var role *model.Role = nil
|
var role *model.Role
|
||||||
var systemAdminRole *model.Role = nil
|
var systemAdminRole *model.Role
|
||||||
var err *model.AppError = nil
|
var err *model.AppError
|
||||||
|
|
||||||
mlog.Info("Migrating emojis config to database.")
|
mlog.Info("Migrating emojis config to database.")
|
||||||
switch *a.Config().ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation {
|
switch *a.Config().ServiceSettings.DEPRECATED_DO_NOT_USE_RestrictCustomEmojiCreation {
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ func TestConfigIsValidFakeAlgorithm(t *testing.T) {
|
|||||||
require.Equal(t, "model.config.is_valid.saml_digest_algorithm.app_error", err.Message)
|
require.Equal(t, "model.config.is_valid.saml_digest_algorithm.app_error", err.Message)
|
||||||
*c1.SamlSettings.DigestAlgorithm = temp
|
*c1.SamlSettings.DigestAlgorithm = temp
|
||||||
|
|
||||||
temp = *c1.SamlSettings.SignatureAlgorithm
|
|
||||||
*c1.SamlSettings.SignatureAlgorithm = "Fake Algorithm"
|
*c1.SamlSettings.SignatureAlgorithm = "Fake Algorithm"
|
||||||
err = c1.SamlSettings.isValid()
|
err = c1.SamlSettings.isValid()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
@@ -1346,7 +1346,6 @@ func (s *SqlPostStore) GetOldest() (*model.Post, *model.AppError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SqlPostStore) determineMaxPostSize() int {
|
func (s *SqlPostStore) determineMaxPostSize() int {
|
||||||
var maxPostSize int = model.POST_MESSAGE_MAX_RUNES_V1
|
|
||||||
var maxPostSizeBytes int32
|
var maxPostSizeBytes int32
|
||||||
|
|
||||||
if s.DriverName() == model.DATABASE_DRIVER_POSTGRES {
|
if s.DriverName() == model.DATABASE_DRIVER_POSTGRES {
|
||||||
@@ -1384,7 +1383,7 @@ func (s *SqlPostStore) determineMaxPostSize() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assume a worst-case representation of four bytes per rune.
|
// Assume a worst-case representation of four bytes per rune.
|
||||||
maxPostSize = int(maxPostSizeBytes) / 4
|
maxPostSize := int(maxPostSizeBytes) / 4
|
||||||
|
|
||||||
// To maintain backwards compatibility, don't yield a maximum post
|
// To maintain backwards compatibility, don't yield a maximum post
|
||||||
// size smaller than the previous limit, even though it wasn't
|
// size smaller than the previous limit, even though it wasn't
|
||||||
|
|||||||
@@ -699,7 +699,7 @@ func (ss *SqlSupplier) AlterColumnDefaultIfExists(tableName string, columnName s
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultValue = ""
|
var defaultValue string
|
||||||
if ss.DriverName() == model.DATABASE_DRIVER_MYSQL {
|
if ss.DriverName() == model.DATABASE_DRIVER_MYSQL {
|
||||||
// Some column types in MySQL cannot have defaults, so don't try to configure anything.
|
// Some column types in MySQL cannot have defaults, so don't try to configure anything.
|
||||||
if mySqlColDefault == nil {
|
if mySqlColDefault == nil {
|
||||||
|
|||||||
@@ -1267,7 +1267,7 @@ func generateSearchQuery(query sq.SelectBuilder, terms []string, fields []string
|
|||||||
func (us SqlUserStore) performSearch(query sq.SelectBuilder, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
func (us SqlUserStore) performSearch(query sq.SelectBuilder, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
||||||
term = sanitizeSearchTerm(term, "*")
|
term = sanitizeSearchTerm(term, "*")
|
||||||
|
|
||||||
searchType := USER_SEARCH_TYPE_NAMES_NO_FULL_NAME
|
var searchType []string
|
||||||
if options.AllowEmails {
|
if options.AllowEmails {
|
||||||
if options.AllowFullNames {
|
if options.AllowFullNames {
|
||||||
searchType = USER_SEARCH_TYPE_ALL
|
searchType = USER_SEARCH_TYPE_ALL
|
||||||
|
|||||||
@@ -513,7 +513,8 @@ func TestMergeWithSlices(t *testing.T) {
|
|||||||
assert.Equal(t, expected, merged)
|
assert.Equal(t, expected, merged)
|
||||||
// of course this won't change merged, even if it did copy... but just in case.
|
// of course this won't change merged, even if it did copy... but just in case.
|
||||||
m2 = append(m2, "test")
|
m2 = append(m2, "test")
|
||||||
assert.Equal(t, 0, len(merged))
|
assert.Len(t, m2, 1)
|
||||||
|
assert.Len(t, merged, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("slice is not copied. change in patch will not affect merged", func(t *testing.T) {
|
t.Run("slice is not copied. change in patch will not affect merged", func(t *testing.T) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user