Bump golangci version to v1.38.0 (#17154)
* Update golangci to v1.38.0 Co-authored-by: Claudio Costa <cstcld91@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2d0f5f910a
Коммит
ccc7365ac3
@@ -163,7 +163,7 @@ jobs:
|
|||||||
# and to make more clear when the job fails
|
# and to make more clear when the job fails
|
||||||
check-golangci-lint:
|
check-golangci-lint:
|
||||||
docker:
|
docker:
|
||||||
- image: golangci/golangci-lint:v1.33.2
|
- image: golangci/golangci-lint:v1.38.0
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ empty:
|
|||||||
- echo "empty"
|
- echo "empty"
|
||||||
|
|
||||||
#lint:
|
#lint:
|
||||||
# image: $CI_REGISTRY/mattermost/ci/images/golangci-lint:v1.33.2-1
|
# image: $CI_REGISTRY/mattermost/ci/images/golangci-lint:v1.38.0
|
||||||
# stage: .pre
|
# stage: .pre
|
||||||
# script:
|
# script:
|
||||||
# - GO111MODULE=off GOBIN=$PWD/bin go get -u github.com/mattermost/mattermost-govet
|
# - GO111MODULE=off GOBIN=$PWD/bin go get -u github.com/mattermost/mattermost-govet
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ linters-settings:
|
|||||||
govet:
|
govet:
|
||||||
check-shadowing: true
|
check-shadowing: true
|
||||||
enable-all: true
|
enable-all: true
|
||||||
|
disable:
|
||||||
|
- fieldalignment
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
@@ -20,7 +22,7 @@ linters:
|
|||||||
- gosimple
|
- gosimple
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- scopelint
|
- exportloopref
|
||||||
- structcheck
|
- structcheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- unconvert
|
- unconvert
|
||||||
@@ -39,11 +41,6 @@ issues:
|
|||||||
- unused
|
- unused
|
||||||
text: "SetupEnterprise"
|
text: "SetupEnterprise"
|
||||||
|
|
||||||
- linters:
|
|
||||||
- scopelint
|
|
||||||
# ignore warnings from table tests. https://github.com/kyoh86/scopelint/issues/4
|
|
||||||
path: ".*_test.go|store/storetest"
|
|
||||||
|
|
||||||
- linters:
|
- linters:
|
||||||
- staticcheck
|
- staticcheck
|
||||||
path: ".*_test.go|store/storetest"
|
path: ".*_test.go|store/storetest"
|
||||||
|
|||||||
@@ -1439,6 +1439,7 @@ func TestConvertBotToUser(t *testing.T) {
|
|||||||
|
|
||||||
user, resp := client.ConvertBotToUser(bot.UserId, &model.UserPatch{}, false)
|
user, resp := client.ConvertBotToUser(bot.UserId, &model.UserPatch{}, false)
|
||||||
CheckBadRequestStatus(t, resp)
|
CheckBadRequestStatus(t, resp)
|
||||||
|
require.Nil(t, user)
|
||||||
|
|
||||||
user, resp = client.ConvertBotToUser(bot.UserId, &model.UserPatch{Password: model.NewString("password")}, false)
|
user, resp = client.ConvertBotToUser(bot.UserId, &model.UserPatch{Password: model.NewString("password")}, false)
|
||||||
CheckNoError(t, resp)
|
CheckNoError(t, resp)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ func TestGetConfigAnyFlagsAccess(t *testing.T) {
|
|||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
|
||||||
th.Client.Login(th.BasicUser.Username, th.BasicUser.Password)
|
th.Client.Login(th.BasicUser.Username, th.BasicUser.Password)
|
||||||
cfg, resp := th.Client.GetConfig()
|
_, resp := th.Client.GetConfig()
|
||||||
|
|
||||||
t.Run("Check permissions error with no sysconsole read permission", func(t *testing.T) {
|
t.Run("Check permissions error with no sysconsole read permission", func(t *testing.T) {
|
||||||
CheckForbiddenStatus(t, resp)
|
CheckForbiddenStatus(t, resp)
|
||||||
@@ -111,7 +111,7 @@ func TestGetConfigAnyFlagsAccess(t *testing.T) {
|
|||||||
th.AddPermissionToRole(model.PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_RATE_LIMITING.Id, model.SYSTEM_USER_ROLE_ID)
|
th.AddPermissionToRole(model.PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_RATE_LIMITING.Id, model.SYSTEM_USER_ROLE_ID)
|
||||||
defer th.RemovePermissionFromRole(model.PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_RATE_LIMITING.Id, model.SYSTEM_USER_ROLE_ID)
|
defer th.RemovePermissionFromRole(model.PERMISSION_SYSCONSOLE_READ_ENVIRONMENT_RATE_LIMITING.Id, model.SYSTEM_USER_ROLE_ID)
|
||||||
|
|
||||||
cfg, resp = th.Client.GetConfig()
|
cfg, resp := th.Client.GetConfig()
|
||||||
CheckNoError(t, resp)
|
CheckNoError(t, resp)
|
||||||
t.Run("Can read value with permission", func(t *testing.T) {
|
t.Run("Can read value with permission", func(t *testing.T) {
|
||||||
assert.NotNil(t, cfg.FeatureFlags)
|
assert.NotNil(t, cfg.FeatureFlags)
|
||||||
|
|||||||
@@ -1726,6 +1726,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
|||||||
require.NotNil(t, resp.Error)
|
require.NotNil(t, resp.Error)
|
||||||
require.Equal(t, "api.context.invalid_url_param.app_error", resp.Error.Id)
|
require.Equal(t, "api.context.invalid_url_param.app_error", resp.Error.Id)
|
||||||
require.Equal(t, http.StatusBadRequest, resp.StatusCode)
|
require.Equal(t, http.StatusBadRequest, resp.StatusCode)
|
||||||
|
require.Nil(t, posts)
|
||||||
|
|
||||||
// All returned posts are all read by the user, since it's created by the user itself.
|
// All returned posts are all read by the user, since it's created by the user itself.
|
||||||
posts, resp = Client.GetPostsAroundLastUnread(userId, channelId, 20, 20, false)
|
posts, resp = Client.GetPostsAroundLastUnread(userId, channelId, 20, 20, false)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ func TestCreateTermsOfServiceAdminUser(t *testing.T) {
|
|||||||
|
|
||||||
termsOfService, resp := Client.CreateTermsOfService("terms of service new", th.SystemAdminUser.Id)
|
termsOfService, resp := Client.CreateTermsOfService("terms of service new", th.SystemAdminUser.Id)
|
||||||
CheckErrorMessage(t, resp, "api.create_terms_of_service.custom_terms_of_service_disabled.app_error")
|
CheckErrorMessage(t, resp, "api.create_terms_of_service.custom_terms_of_service_disabled.app_error")
|
||||||
|
assert.Nil(t, termsOfService)
|
||||||
|
|
||||||
th.App.Srv().SetLicense(model.NewTestLicense("EnableCustomTermsOfService"))
|
th.App.Srv().SetLicense(model.NewTestLicense("EnableCustomTermsOfService"))
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ func TestUploadFile(t *testing.T) {
|
|||||||
|
|
||||||
info1, err = th.App.UploadFile(data, "", filename)
|
info1, err = th.App.UploadFile(data, "", filename)
|
||||||
require.Nil(t, err, "empty channel IDs should be valid")
|
require.Nil(t, err, "empty channel IDs should be valid")
|
||||||
|
require.NotNil(t, info1)
|
||||||
|
|
||||||
info1, err = th.App.UploadFile(data, channelID, filename)
|
info1, err = th.App.UploadFile(data, channelID, filename)
|
||||||
require.Nil(t, err, "UploadFile should succeed with valid data")
|
require.Nil(t, err, "UploadFile should succeed with valid data")
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ func TestUpsertGroupSyncableTeamGroupConstrained(t *testing.T) {
|
|||||||
team, err := th.App.UpdateTeam(team)
|
team, err := th.App.UpdateTeam(team)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
_, err = th.App.UpsertGroupSyncable(model.NewGroupTeam(group1.Id, team.Id, false))
|
_, err = th.App.UpsertGroupSyncable(model.NewGroupTeam(group1.Id, team.Id, false))
|
||||||
|
require.Nil(t, err)
|
||||||
|
|
||||||
channel := th.CreateChannel(team)
|
channel := th.CreateChannel(team)
|
||||||
|
|
||||||
|
|||||||
@@ -3936,6 +3936,7 @@ func TestImportPostAndRepliesWithAttachments(t *testing.T) {
|
|||||||
}, false)
|
}, false)
|
||||||
user3, appErr := th.App.GetUserByUsername(username)
|
user3, appErr := th.App.GetUserByUsername(username)
|
||||||
require.Nil(t, appErr, "Failed to get user3 from database.")
|
require.Nil(t, appErr, "Failed to get user3 from database.")
|
||||||
|
require.NotNil(t, user3)
|
||||||
|
|
||||||
username2 := model.NewId()
|
username2 := model.NewId()
|
||||||
th.App.importUser(&UserImportData{
|
th.App.importUser(&UserImportData{
|
||||||
|
|||||||
@@ -585,8 +585,7 @@ func (a *App) UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model
|
|||||||
return nil, model.NewAppError("UpdatePost", "api.post.update_post.can_not_update_post_in_deleted.error", nil, "", http.StatusBadRequest)
|
return nil, model.NewAppError("UpdatePost", "api.post.update_post.can_not_update_post_in_deleted.error", nil, "", http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
newPost := &model.Post{}
|
newPost := oldPost.Clone()
|
||||||
newPost = oldPost.Clone()
|
|
||||||
|
|
||||||
if newPost.Message != post.Message {
|
if newPost.Message != post.Message {
|
||||||
newPost.Message = post.Message
|
newPost.Message = post.Message
|
||||||
|
|||||||
@@ -260,8 +260,7 @@ func TestUpdatePostEditAt(t *testing.T) {
|
|||||||
th := Setup(t).InitBasic()
|
th := Setup(t).InitBasic()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
|
||||||
post := &model.Post{}
|
post := th.BasicPost.Clone()
|
||||||
post = th.BasicPost.Clone()
|
|
||||||
|
|
||||||
post.IsPinned = true
|
post.IsPinned = true
|
||||||
saved, err := th.App.UpdatePost(post, true)
|
saved, err := th.App.UpdatePost(post, true)
|
||||||
@@ -283,8 +282,7 @@ func TestUpdatePostTimeLimit(t *testing.T) {
|
|||||||
th := Setup(t).InitBasic()
|
th := Setup(t).InitBasic()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
|
||||||
post := &model.Post{}
|
post := th.BasicPost.Clone()
|
||||||
post = th.BasicPost.Clone()
|
|
||||||
|
|
||||||
th.App.Srv().SetLicense(model.NewTestLicense())
|
th.App.Srv().SetLicense(model.NewTestLicense())
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ func TestHandleCommandResponsePost(t *testing.T) {
|
|||||||
// Command is not built in, so it is a bot command.
|
// Command is not built in, so it is a bot command.
|
||||||
builtIn = false
|
builtIn = false
|
||||||
post, err = th.App.HandleCommandResponsePost(command, args, resp, builtIn)
|
post, err = th.App.HandleCommandResponsePost(command, args, resp, builtIn)
|
||||||
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, "true", post.GetProp("from_webhook"))
|
assert.Equal(t, "true", post.GetProp("from_webhook"))
|
||||||
|
|
||||||
builtIn = true
|
builtIn = true
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ func TestTriggerIdDecodeAndVerification(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("should fail on bad key", func(t *testing.T) {
|
t.Run("should fail on bad key", func(t *testing.T) {
|
||||||
_, triggerId, err := GenerateTriggerId(NewId(), key)
|
_, triggerId, err := GenerateTriggerId(NewId(), key)
|
||||||
|
require.Nil(t, err)
|
||||||
newKey, keyErr := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
newKey, keyErr := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||||
require.NoError(t, keyErr)
|
require.NoError(t, keyErr)
|
||||||
_, _, err = DecodeAndVerifyTriggerId(triggerId, newKey)
|
_, _, err = DecodeAndVerifyTriggerId(triggerId, newKey)
|
||||||
|
|||||||
@@ -838,7 +838,8 @@ func TestPostPatchDisableMentionHighlights(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.Name, func(t *testing.T) {
|
t.Run(tc.Name, func(t *testing.T) {
|
||||||
patch.Message = &tc.Message
|
message := tc.Message
|
||||||
|
patch.Message = &message
|
||||||
patch.DisableMentionHighlights()
|
patch.DisableMentionHighlights()
|
||||||
if tc.ExpectedProps == nil {
|
if tc.ExpectedProps == nil {
|
||||||
assert.Nil(t, patch.Props)
|
assert.Nil(t, patch.Props)
|
||||||
|
|||||||
@@ -376,7 +376,6 @@ func testChannelStoreGet(t *testing.T, ss store.Store, s SqlStore) {
|
|||||||
_, nErr := ss.Channel().Save(&o1, -1)
|
_, nErr := ss.Channel().Save(&o1, -1)
|
||||||
require.NoError(t, nErr)
|
require.NoError(t, nErr)
|
||||||
|
|
||||||
c1 := &model.Channel{}
|
|
||||||
c1, err := ss.Channel().Get(o1.Id, false)
|
c1, err := ss.Channel().Get(o1.Id, false)
|
||||||
require.NoError(t, err, err)
|
require.NoError(t, err, err)
|
||||||
require.Equal(t, o1.ToJson(), c1.ToJson(), "invalid returned channel")
|
require.Equal(t, o1.ToJson(), c1.ToJson(), "invalid returned channel")
|
||||||
|
|||||||
@@ -830,8 +830,7 @@ func testEditExportMessage(t *testing.T, ss store.Store) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
//user 1 edits the previous post
|
//user 1 edits the previous post
|
||||||
post1e := &model.Post{}
|
post1e := post1.Clone()
|
||||||
post1e = post1.Clone()
|
|
||||||
post1e.Message = "edit " + post1.Message
|
post1e.Message = "edit " + post1.Message
|
||||||
|
|
||||||
post1e, err = ss.Post().Update(post1e, post1)
|
post1e, err = ss.Post().Update(post1e, post1)
|
||||||
@@ -942,8 +941,7 @@ func testEditAfterExportMessage(t *testing.T, ss store.Store) {
|
|||||||
|
|
||||||
postEditTime := post1.UpdateAt + 1
|
postEditTime := post1.UpdateAt + 1
|
||||||
//user 1 edits the previous post
|
//user 1 edits the previous post
|
||||||
post1e := &model.Post{}
|
post1e := post1.Clone()
|
||||||
post1e = post1.Clone()
|
|
||||||
post1e.EditAt = postEditTime
|
post1e.EditAt = postEditTime
|
||||||
post1e.Message = "edit " + post1.Message
|
post1e.Message = "edit " + post1.Message
|
||||||
post1e, err = ss.Post().Update(post1e, post1)
|
post1e, err = ss.Post().Update(post1e, post1)
|
||||||
|
|||||||
@@ -1358,6 +1358,7 @@ func testTeamSaveMember(t *testing.T, ss store.Store) {
|
|||||||
|
|
||||||
m1 := &model.TeamMember{TeamId: teamID, UserId: u1.Id}
|
m1 := &model.TeamMember{TeamId: teamID, UserId: u1.Id}
|
||||||
_, nErr := ss.Team().SaveMember(m1, 1)
|
_, nErr := ss.Team().SaveMember(m1, 1)
|
||||||
|
require.NoError(t, nErr)
|
||||||
m2 := &model.TeamMember{TeamId: teamID, UserId: u2.Id}
|
m2 := &model.TeamMember{TeamId: teamID, UserId: u2.Id}
|
||||||
_, nErr = ss.Team().SaveMember(m2, 1)
|
_, nErr = ss.Team().SaveMember(m2, 1)
|
||||||
require.Error(t, nErr)
|
require.Error(t, nErr)
|
||||||
|
|||||||
4
vendor/modules.txt
поставляемый
4
vendor/modules.txt
поставляемый
@@ -197,6 +197,8 @@ github.com/francoispqt/gojay
|
|||||||
# github.com/fsnotify/fsnotify v1.4.9
|
# github.com/fsnotify/fsnotify v1.4.9
|
||||||
## explicit
|
## explicit
|
||||||
github.com/fsnotify/fsnotify
|
github.com/fsnotify/fsnotify
|
||||||
|
# github.com/getkin/kin-openapi v0.49.0
|
||||||
|
## explicit
|
||||||
# github.com/getsentry/sentry-go v0.10.0
|
# github.com/getsentry/sentry-go v0.10.0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/getsentry/sentry-go
|
github.com/getsentry/sentry-go
|
||||||
@@ -399,6 +401,8 @@ github.com/mattermost/ldap
|
|||||||
github.com/mattermost/logr
|
github.com/mattermost/logr
|
||||||
github.com/mattermost/logr/format
|
github.com/mattermost/logr/format
|
||||||
github.com/mattermost/logr/target
|
github.com/mattermost/logr/target
|
||||||
|
# github.com/mattermost/mattermost-govet v0.0.0-20210226164958-a9556728767b
|
||||||
|
## explicit
|
||||||
# github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0
|
# github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/mattermost/rsc/gf256
|
github.com/mattermost/rsc/gf256
|
||||||
|
|||||||
@@ -140,8 +140,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}()
|
}()
|
||||||
c.App.SetContext(ctx)
|
c.App.SetContext(ctx)
|
||||||
|
|
||||||
tmpSrv := app.Server{}
|
tmpSrv := *c.App.Srv()
|
||||||
tmpSrv = *c.App.Srv()
|
|
||||||
tmpSrv.Store = opentracinglayer.New(c.App.Srv().Store, ctx)
|
tmpSrv.Store = opentracinglayer.New(c.App.Srv().Store, ctx)
|
||||||
c.App.SetServer(&tmpSrv)
|
c.App.SetServer(&tmpSrv)
|
||||||
c.App = app_opentracing.NewOpenTracingAppLayer(c.App, ctx)
|
c.App = app_opentracing.NewOpenTracingAppLayer(c.App, ctx)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user