Enable the errorAssertions govet check for mattermost-server code (#17346)

* Enable the errorAssertions govet check for mattermost-server code

* Removing unnecesary change

* Fixing some tests

* Fixing tests

* Fixing more after merge

* Fixing new offending entries

* Fixing small vet checks

* Fixing new cases detected by govet

* Fixing remote_cluster_test errors

* Fixing assertion

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Jesús Espino
2021-04-12 12:51:31 +02:00
коммит произвёл GitHub
родитель e37e902ddf
Коммит 35d00b4644
22 изменённых файлов: 202 добавлений и 199 удалений

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

@@ -1085,37 +1085,37 @@ func TestSearchFiles(t *testing.T) {
Client := th.Client
filename := "search for fileInfo1"
fileInfo1, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, err)
fileInfo1, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, appErr)
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo1.Id, th.BasicPost.Id, th.BasicUser.Id)
require.Nil(t, err)
require.NoError(t, err)
filename = "search for fileInfo2"
fileInfo2, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, err)
fileInfo2, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, appErr)
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo2.Id, th.BasicPost.Id, th.BasicUser.Id)
require.Nil(t, err)
require.NoError(t, err)
filename = "tagged search for fileInfo3"
fileInfo3, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, err)
fileInfo3, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, appErr)
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo3.Id, th.BasicPost.Id, th.BasicUser.Id)
require.Nil(t, err)
require.NoError(t, err)
filename = "tagged for fileInfo4"
fileInfo4, err := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, err)
fileInfo4, appErr := th.App.UploadFile(data, th.BasicChannel.Id, filename)
require.Nil(t, appErr)
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo4.Id, th.BasicPost.Id, th.BasicUser.Id)
require.Nil(t, err)
require.NoError(t, err)
archivedChannel := th.CreatePublicChannel()
fileInfo5, err := th.App.UploadFile(data, archivedChannel.Id, "tagged for fileInfo3")
require.Nil(t, err)
fileInfo5, appErr := th.App.UploadFile(data, archivedChannel.Id, "tagged for fileInfo3")
require.Nil(t, appErr)
post := &model.Post{ChannelId: archivedChannel.Id, Message: model.NewId() + "a"}
rpost, resp := Client.CreatePost(post)
CheckNoError(t, resp)
err = th.App.Srv().Store.FileInfo().AttachToPost(fileInfo5.Id, rpost.Id, th.BasicUser.Id)
require.Nil(t, err)
require.NoError(t, err)
th.Client.DeleteChannel(archivedChannel.Id)
terms := "search"