MM-52532: Fix golangci warnings (#23709)

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

- Replace golint with revive
- Add makezero linter
- Fix all the required linter failures

Some issues in enterprise and public modules
are yet to be fixed. We send this to expediate things.
Этот коммит содержится в:
Agniva De Sarker
2023-06-13 14:08:36 +05:30
коммит произвёл GitHub
родитель 62a3ee8adc
Коммит c249ba4a66
49 изменённых файлов: 145 добавлений и 140 удалений

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

@@ -45,10 +45,10 @@ func (pd *PluginDelivery) UserByUsername(username string) (*mm_model.User, error
// is a special character for usernames (dot, dash or underscore). If not, it
// returns the same string.
func trimUsernameSpecialChar(word string) (string, bool) {
len := len(word)
l := len(word)
if len > 0 && strings.LastIndexAny(word, usernameSpecialChars) == (len-1) {
return word[:len-1], true
if l > 0 && strings.LastIndexAny(word, usernameSpecialChars) == (l-1) {
return word[:l-1], true
}
return word, false

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

@@ -934,9 +934,8 @@ func (s *MattermostAuthLayer) boardsFromRows(rows *sql.Rows, removeDuplicates bo
if removeDuplicates {
if _, ok := idMap[board.ID]; ok {
continue
} else {
idMap[board.ID] = struct{}{}
}
idMap[board.ID] = struct{}{}
}
err = json.Unmarshal(propertiesBytes, &board.Properties)

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

@@ -88,7 +88,7 @@ func (s *SQLStore) updateCardLimitTimestamp(db sq.BaseRunner, cardLimit int) (in
Insert(s.tablePrefix+"system_settings").
Columns("id", "value")
var value interface{} = 0
var value any = 0 //nolint:revive
if cardLimit != 0 {
value = s.activeCardsQuery(sq.StatementBuilder, "b.update_at", cardLimit).
OrderBy("b.update_at DESC").