diff --git a/.golangci.yml b/.golangci.yml index 29d9a4622a4..06adcba6bca 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,6 +10,8 @@ linters-settings: govet: check-shadowing: true enable-all: true + goimports: + local-prefixes: github.com/mattermost/mattermost-server/v5 linters: disable-all: true @@ -27,6 +29,7 @@ linters: - unused - varcheck - misspell + - goimports # TODO: enable this later # - errcheck @@ -52,7 +55,7 @@ issues: text: "should have|should be|should replace|stutters|underscore|annoying|error strings should not be capitalized" - linters: - - golint + - golint path: "model/" - linters: diff --git a/api4/api.go b/api4/api.go index 926b6190074..7517d814a60 100644 --- a/api4/api.go +++ b/api4/api.go @@ -7,12 +7,12 @@ import ( "net/http" "github.com/gorilla/mux" + _ "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/configservice" "github.com/mattermost/mattermost-server/v5/web" - - _ "github.com/mattermost/go-i18n/i18n" ) type Routes struct { diff --git a/api4/apitestlib.go b/api4/apitestlib.go index de750130d8c..d674ffd931a 100644 --- a/api4/apitestlib.go +++ b/api4/apitestlib.go @@ -17,6 +17,10 @@ import ( "testing" "time" + s3 "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/mlog" @@ -29,10 +33,6 @@ import ( "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/web" "github.com/mattermost/mattermost-server/v5/wsapi" - - s3 "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" - "github.com/stretchr/testify/require" ) type TestHelper struct { diff --git a/api4/bot_test.go b/api4/bot_test.go index 8f3efa339a7..5b43f5ee0da 100644 --- a/api4/bot_test.go +++ b/api4/bot_test.go @@ -12,10 +12,11 @@ import ( "strings" "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/fileutils" "github.com/mattermost/mattermost-server/v5/utils/testutils" - "github.com/stretchr/testify/require" ) func TestCreateBot(t *testing.T) { diff --git a/api4/brand_test.go b/api4/brand_test.go index 512f0c82afd..2f5ae84c2d6 100644 --- a/api4/brand_test.go +++ b/api4/brand_test.go @@ -7,8 +7,9 @@ import ( "net/http" "testing" - "github.com/mattermost/mattermost-server/v5/utils/testutils" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/utils/testutils" ) func TestGetBrandImage(t *testing.T) { diff --git a/api4/channel_category_test.go b/api4/channel_category_test.go index 1e2a2cba7ab..5667e2ff60d 100644 --- a/api4/channel_category_test.go +++ b/api4/channel_category_test.go @@ -6,9 +6,10 @@ package api4 import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCreateCategoryForTeamForUser(t *testing.T) { diff --git a/api4/channel_test.go b/api4/channel_test.go index d781e1fb281..3f44812809a 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -12,12 +12,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestCreateChannel(t *testing.T) { diff --git a/api4/cluster_test.go b/api4/cluster_test.go index a245a4aacbc..5e1fa95d982 100644 --- a/api4/cluster_test.go +++ b/api4/cluster_test.go @@ -6,8 +6,9 @@ package api4 import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetClusterStatus(t *testing.T) { diff --git a/api4/command_help_test.go b/api4/command_help_test.go index 888386c0a16..a35b4aac15a 100644 --- a/api4/command_help_test.go +++ b/api4/command_help_test.go @@ -6,8 +6,9 @@ package api4 import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestHelpCommand(t *testing.T) { diff --git a/api4/commands_test.go b/api4/commands_test.go index 17e236fe51d..9167e4e60ce 100644 --- a/api4/commands_test.go +++ b/api4/commands_test.go @@ -8,8 +8,9 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestEchoCommand(t *testing.T) { diff --git a/api4/compliance.go b/api4/compliance.go index b7c67e58842..9ad6905ff15 100644 --- a/api4/compliance.go +++ b/api4/compliance.go @@ -8,6 +8,7 @@ import ( "strconv" "github.com/avct/uasurfer" + "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/api4/config_test.go b/api4/config_test.go index 944435cfbe1..23945760ddb 100644 --- a/api4/config_test.go +++ b/api4/config_test.go @@ -9,10 +9,11 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v5/config" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/config" + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetConfig(t *testing.T) { diff --git a/api4/cors_test.go b/api4/cors_test.go index 5faed407d5d..1ab4802262e 100644 --- a/api4/cors_test.go +++ b/api4/cors_test.go @@ -8,10 +8,11 @@ import ( "net/http" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" ) const ( diff --git a/api4/emoji_test.go b/api4/emoji_test.go index 59802aae237..3b040b67770 100644 --- a/api4/emoji_test.go +++ b/api4/emoji_test.go @@ -11,14 +11,13 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" + "github.com/mattermost/mattermost-server/v5/utils/fileutils" ) func TestCreateEmoji(t *testing.T) { diff --git a/api4/file_test.go b/api4/file_test.go index 6469496512b..9bcfb17a6f0 100644 --- a/api4/file_test.go +++ b/api4/file_test.go @@ -19,12 +19,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/fileutils" "github.com/mattermost/mattermost-server/v5/utils/testutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var testDir = "" diff --git a/api4/group_test.go b/api4/group_test.go index 37703c6a98a..26f46da3575 100644 --- a/api4/group_test.go +++ b/api4/group_test.go @@ -9,9 +9,10 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetGroup(t *testing.T) { diff --git a/api4/handlers.go b/api4/handlers.go index f42ed676c04..aa6fa996663 100644 --- a/api4/handlers.go +++ b/api4/handlers.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/NYTimes/gziphandler" + "github.com/mattermost/mattermost-server/v5/web" ) diff --git a/api4/import_test.go b/api4/import_test.go index 746226f6f1f..56e492ff900 100644 --- a/api4/import_test.go +++ b/api4/import_test.go @@ -8,10 +8,10 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - - "github.com/stretchr/testify/require" ) func TestListImports(t *testing.T) { diff --git a/api4/integration_action_test.go b/api4/integration_action_test.go index 4924f87eb98..e862bc6ce03 100644 --- a/api4/integration_action_test.go +++ b/api4/integration_action_test.go @@ -12,9 +12,9 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/model" - "github.com/stretchr/testify/require" ) type testHandler struct { diff --git a/api4/job_test.go b/api4/job_test.go index 50e810939da..b2f809e96cc 100644 --- a/api4/job_test.go +++ b/api4/job_test.go @@ -9,8 +9,9 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCreateJob(t *testing.T) { diff --git a/api4/oauth_test.go b/api4/oauth_test.go index 82d11912e59..55ba43bf145 100644 --- a/api4/oauth_test.go +++ b/api4/oauth_test.go @@ -8,9 +8,10 @@ import ( "net/http" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCreateOAuthApp(t *testing.T) { diff --git a/api4/plugin_test.go b/api4/plugin_test.go index 4341267686f..86e4f388a82 100644 --- a/api4/plugin_test.go +++ b/api4/plugin_test.go @@ -18,15 +18,15 @@ import ( "testing" "time" + svg "github.com/h2non/go-is-svg" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/testlib" "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - - svg "github.com/h2non/go-is-svg" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPlugin(t *testing.T) { diff --git a/api4/reaction_test.go b/api4/reaction_test.go index f15750fcf8c..e247187ab6d 100644 --- a/api4/reaction_test.go +++ b/api4/reaction_test.go @@ -7,9 +7,10 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestSaveReaction(t *testing.T) { diff --git a/api4/saml_test.go b/api4/saml_test.go index 2625cb4eab3..b0c1131b64b 100644 --- a/api4/saml_test.go +++ b/api4/saml_test.go @@ -7,9 +7,9 @@ import ( "net/http" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetSamlMetadata(t *testing.T) { diff --git a/api4/status_test.go b/api4/status_test.go index 70eb52d7e85..10f0b65453c 100644 --- a/api4/status_test.go +++ b/api4/status_test.go @@ -6,8 +6,9 @@ package api4 import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetUserStatus(t *testing.T) { diff --git a/api4/system_test.go b/api4/system_test.go index fcd6c747d74..2515d4e08cb 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -14,10 +14,11 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetPing(t *testing.T) { diff --git a/api4/team_local.go b/api4/team_local.go index efabe2cb948..719a57bc155 100644 --- a/api4/team_local.go +++ b/api4/team_local.go @@ -7,11 +7,11 @@ import ( "net/http" "strings" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) func (api *API) InitTeamLocal() { diff --git a/api4/team_test.go b/api4/team_test.go index 939a10cfec2..3a128d08ab2 100644 --- a/api4/team_test.go +++ b/api4/team_test.go @@ -12,13 +12,14 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/mailservice" "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/utils/testutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestCreateTeam(t *testing.T) { diff --git a/api4/terms_of_service_test.go b/api4/terms_of_service_test.go index 3bb8f38c84c..8b27dcb94e2 100644 --- a/api4/terms_of_service_test.go +++ b/api4/terms_of_service_test.go @@ -6,9 +6,10 @@ package api4 import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetTermsOfService(t *testing.T) { diff --git a/api4/upload_test.go b/api4/upload_test.go index bd3ac4c1a3b..4f290837c9d 100644 --- a/api4/upload_test.go +++ b/api4/upload_test.go @@ -11,10 +11,10 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - - "github.com/stretchr/testify/require" ) func TestCreateUpload(t *testing.T) { diff --git a/api4/user_test.go b/api4/user_test.go index f43954cf6ad..c81a8bd0010 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -12,12 +12,13 @@ import ( "time" "github.com/dgryski/dgoogauth" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/mailservice" "github.com/mattermost/mattermost-server/v5/utils/testutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestCreateUser(t *testing.T) { diff --git a/api4/user_viewmembers_test.go b/api4/user_viewmembers_test.go index aac51eacbdd..d638a73acd2 100644 --- a/api4/user_viewmembers_test.go +++ b/api4/user_viewmembers_test.go @@ -6,8 +6,9 @@ package api4 import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestApiResctrictedViewMembers(t *testing.T) { diff --git a/api4/websocket.go b/api4/websocket.go index 40720249c35..3e1ee162382 100644 --- a/api4/websocket.go +++ b/api4/websocket.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/gorilla/websocket" + "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/admin.go b/app/admin.go index c340a301432..2ac062613fb 100644 --- a/app/admin.go +++ b/app/admin.go @@ -8,12 +8,10 @@ import ( "fmt" "io" "io/ioutil" - "os" - "time" - - "runtime/debug" - "net/http" + "os" + "runtime/debug" + "time" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/app.go b/app/app.go index 09861f7bdc3..1a2f9bbc8da 100644 --- a/app/app.go +++ b/app/app.go @@ -14,6 +14,7 @@ import ( "github.com/mattermost/go-i18n/i18n" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/audit.go b/app/audit.go index e07282dd74c..9291298cff2 100644 --- a/app/audit.go +++ b/app/audit.go @@ -10,6 +10,7 @@ import ( "os/user" "github.com/hashicorp/go-multierror" + "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/mlog" diff --git a/app/authentication_test.go b/app/authentication_test.go index a3aa8eac814..ad9bd34c00b 100644 --- a/app/authentication_test.go +++ b/app/authentication_test.go @@ -9,8 +9,9 @@ import ( "strconv" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestParseAuthTokenFromRequest(t *testing.T) { diff --git a/app/authorization_test.go b/app/authorization_test.go index c153110d64e..0b433d8c624 100644 --- a/app/authorization_test.go +++ b/app/authorization_test.go @@ -5,14 +5,14 @@ package app import ( "fmt" - "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" + "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" ) func TestCheckIfRolesGrantPermission(t *testing.T) { diff --git a/app/auto_responder_test.go b/app/auto_responder_test.go index 7b61103b250..33ed570af4b 100644 --- a/app/auto_responder_test.go +++ b/app/auto_responder_test.go @@ -6,9 +6,10 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestSetAutoResponderStatus(t *testing.T) { diff --git a/app/busy_test.go b/app/busy_test.go index 8ded6b781c6..c810b3f6ae7 100644 --- a/app/busy_test.go +++ b/app/busy_test.go @@ -8,9 +8,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/model" - "github.com/stretchr/testify/require" ) func TestBusySet(t *testing.T) { diff --git a/app/channel_category.go b/app/channel_category.go index 437f6d8e91b..54a654970df 100644 --- a/app/channel_category.go +++ b/app/channel_category.go @@ -8,10 +8,9 @@ import ( "net/http" "time" - "github.com/mattermost/mattermost-server/v5/store" - "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func (a *App) createInitialSidebarCategories(userId, teamId string) *model.AppError { diff --git a/app/cluster_discovery_test.go b/app/cluster_discovery_test.go index ff1cb534194..e9ba0e72c65 100644 --- a/app/cluster_discovery_test.go +++ b/app/cluster_discovery_test.go @@ -5,7 +5,6 @@ package app import ( "testing" - "time" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/command.go b/app/command.go index daf0020465e..431db31ecbd 100644 --- a/app/command.go +++ b/app/command.go @@ -14,6 +14,7 @@ import ( "unicode" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" diff --git a/app/command_autocomplete_test.go b/app/command_autocomplete_test.go index 622ded3d794..a0b10660c9b 100644 --- a/app/command_autocomplete_test.go +++ b/app/command_autocomplete_test.go @@ -8,8 +8,9 @@ import ( "testing" goi18n "github.com/mattermost/go-i18n/i18n" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestParseStaticListArgument(t *testing.T) { diff --git a/app/download.go b/app/download.go index 9f1c180498b..cdfc9b8a984 100644 --- a/app/download.go +++ b/app/download.go @@ -10,10 +10,10 @@ import ( "net/url" "time" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - - "github.com/pkg/errors" ) const ( diff --git a/app/download_test.go b/app/download_test.go index 39cdb54cd53..7a7f7fa6253 100644 --- a/app/download_test.go +++ b/app/download_test.go @@ -9,9 +9,9 @@ import ( "net/http/httptest" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestDownloadFromURL(t *testing.T) { diff --git a/app/email.go b/app/email.go index fcab7de6974..ec6bf16c0fb 100644 --- a/app/email.go +++ b/app/email.go @@ -8,13 +8,12 @@ import ( "encoding/json" "fmt" "io" + "net/http" "net/url" "path" "strings" "time" - "net/http" - "github.com/mattermost/go-i18n/i18n" "github.com/pkg/errors" "github.com/throttled/throttled" diff --git a/app/email_batching.go b/app/email_batching.go index 06e89150dcd..bcae6590008 100644 --- a/app/email_batching.go +++ b/app/email_batching.go @@ -6,17 +6,16 @@ package app import ( "fmt" "html/template" + "net/http" "strconv" "sync" "time" + "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - - "net/http" - - "github.com/mattermost/go-i18n/i18n" ) const ( diff --git a/app/email_batching_test.go b/app/email_batching_test.go index ee332aaa08c..36c37a57bf4 100644 --- a/app/email_batching_test.go +++ b/app/email_batching_test.go @@ -9,9 +9,9 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/model" - "github.com/stretchr/testify/require" ) func TestHandleNewNotifications(t *testing.T) { diff --git a/app/email_test.go b/app/email_test.go index f38a90f0c4d..4f50c1a469e 100644 --- a/app/email_test.go +++ b/app/email_test.go @@ -8,9 +8,10 @@ import ( "strconv" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCondenseSiteURL(t *testing.T) { diff --git a/app/emoji.go b/app/emoji.go index 52e5de9621a..a300986df9f 100644 --- a/app/emoji.go +++ b/app/emoji.go @@ -19,6 +19,7 @@ import ( "path" "github.com/disintegration/imaging" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" diff --git a/app/enterprise_test.go b/app/enterprise_test.go index 4366e908e63..7b46552a7ba 100644 --- a/app/enterprise_test.go +++ b/app/enterprise_test.go @@ -6,12 +6,13 @@ package app import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/einterfaces/mocks" "github.com/mattermost/mattermost-server/v5/model" storemocks "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" ) func TestSAMLSettings(t *testing.T) { diff --git a/app/expirynotify_test.go b/app/expirynotify_test.go index 764c7b9c57f..d90d1c06948 100644 --- a/app/expirynotify_test.go +++ b/app/expirynotify_test.go @@ -8,8 +8,9 @@ import ( "net/http/httptest" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestNotifySessionsExpired(t *testing.T) { diff --git a/app/export.go b/app/export.go index 222f04d463f..73bb8aaa2c6 100644 --- a/app/export.go +++ b/app/export.go @@ -11,11 +11,11 @@ import ( "path/filepath" "strings" - "github.com/mattermost/mattermost-server/v5/store" + "github.com/pkg/errors" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" - "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/store" ) // We use this map to identify the exportable preferences. diff --git a/app/extract_plugin_tar.go b/app/extract_plugin_tar.go index f7ed301bf53..d3461a3257d 100644 --- a/app/extract_plugin_tar.go +++ b/app/extract_plugin_tar.go @@ -11,8 +11,9 @@ import ( "path/filepath" "strings" - "github.com/mattermost/mattermost-server/v5/mlog" "github.com/pkg/errors" + + "github.com/mattermost/mattermost-server/v5/mlog" ) // extractTarGz takes in an io.Reader containing the bytes for a .tar.gz file and diff --git a/app/group_test.go b/app/group_test.go index 62099076f80..8e55166d7fa 100644 --- a/app/group_test.go +++ b/app/group_test.go @@ -6,9 +6,10 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetGroup(t *testing.T) { diff --git a/app/helper_test.go b/app/helper_test.go index 8e3f97452aa..b9cc09f39ae 100644 --- a/app/helper_test.go +++ b/app/helper_test.go @@ -10,9 +10,10 @@ import ( "path/filepath" "strings" "sync" + "testing" "time" - "testing" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/mlog" @@ -23,7 +24,6 @@ import ( "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/mattermost/mattermost-server/v5/testlib" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/require" ) type TestHelper struct { diff --git a/app/import.go b/app/import.go index cefbb97dc1f..d8783d8e4be 100644 --- a/app/import.go +++ b/app/import.go @@ -14,7 +14,6 @@ import ( "sync" "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/import_types.go b/app/import_types.go index 57d517263e0..0a5fef534cd 100644 --- a/app/import_types.go +++ b/app/import_types.go @@ -3,7 +3,9 @@ package app -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) // Import Data Models diff --git a/app/import_validators_test.go b/app/import_validators_test.go index af3e671c662..8cd22acf922 100644 --- a/app/import_validators_test.go +++ b/app/import_validators_test.go @@ -9,11 +9,11 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/assert" ) func TestImportValidateSchemeImportData(t *testing.T) { diff --git a/app/job_test.go b/app/job_test.go index 90687d29a4d..1fa79453722 100644 --- a/app/job_test.go +++ b/app/job_test.go @@ -6,8 +6,9 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetJob(t *testing.T) { diff --git a/app/license.go b/app/license.go index 7654ad80fe6..d51aa66c1dd 100644 --- a/app/license.go +++ b/app/license.go @@ -11,11 +11,11 @@ import ( "time" "github.com/dgrijalva/jwt-go" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - - "github.com/pkg/errors" ) const ( diff --git a/app/license_test.go b/app/license_test.go index a6bce1bb38c..a1eb00026d9 100644 --- a/app/license_test.go +++ b/app/license_test.go @@ -7,9 +7,10 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestLoadLicense(t *testing.T) { diff --git a/app/login.go b/app/login.go index 38db548b021..71bb8a71492 100644 --- a/app/login.go +++ b/app/login.go @@ -14,6 +14,7 @@ import ( "time" "github.com/avct/uasurfer" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" diff --git a/app/login_test.go b/app/login_test.go index 76a35beae1d..c6f001b8f99 100644 --- a/app/login_test.go +++ b/app/login_test.go @@ -8,8 +8,9 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCheckForClientSideCert(t *testing.T) { diff --git a/app/notification.go b/app/notification.go index 1ddb97726e5..2251c0745cf 100644 --- a/app/notification.go +++ b/app/notification.go @@ -11,12 +11,13 @@ import ( "unicode" "unicode/utf8" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/utils/markdown" - "github.com/pkg/errors" ) func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *model.Channel, sender *model.User, parentPostList *model.PostList, setOnline bool) ([]string, error) { diff --git a/app/notification_email.go b/app/notification_email.go index efe995cfd62..7c9c00e37d0 100644 --- a/app/notification_email.go +++ b/app/notification_email.go @@ -14,6 +14,7 @@ import ( "time" "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" diff --git a/app/notification_push.go b/app/notification_push.go index c8ef59d8f1d..f7debcc39e9 100644 --- a/app/notification_push.go +++ b/app/notification_push.go @@ -11,9 +11,9 @@ import ( "strings" "sync" + "github.com/mattermost/go-i18n/i18n" "github.com/pkg/errors" - "github.com/mattermost/go-i18n/i18n" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" diff --git a/app/notification_push_test.go b/app/notification_push_test.go index 9d3d107fdf0..293e038f3fc 100644 --- a/app/notification_push_test.go +++ b/app/notification_push_test.go @@ -11,14 +11,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/mattermost/mattermost-server/v5/testlib" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func TestDoesNotifyPropsAllowPushNotification(t *testing.T) { diff --git a/app/oauth_test.go b/app/oauth_test.go index 50f544c6e86..f2c2d7579bc 100644 --- a/app/oauth_test.go +++ b/app/oauth_test.go @@ -11,9 +11,10 @@ import ( "net/http/httptest" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetOAuthAccessTokenForImplicitFlow(t *testing.T) { diff --git a/app/opengraph_test.go b/app/opengraph_test.go index f0e42339d85..5a8a151fb91 100644 --- a/app/opengraph_test.go +++ b/app/opengraph_test.go @@ -4,12 +4,12 @@ package app import ( - "github.com/stretchr/testify/require" "strings" "testing" "github.com/dyatlov/go-opengraph/opengraph" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func BenchmarkForceHTMLEncodingToUTF8(b *testing.B) { diff --git a/app/options.go b/app/options.go index 51302bc26a9..431ab2a9988 100644 --- a/app/options.go +++ b/app/options.go @@ -4,10 +4,10 @@ package app import ( - "github.com/mattermost/mattermost-server/v5/mlog" "github.com/pkg/errors" "github.com/mattermost/mattermost-server/v5/config" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" ) diff --git a/app/permissions.go b/app/permissions.go index d501166907a..295a047b89a 100644 --- a/app/permissions.go +++ b/app/permissions.go @@ -10,8 +10,9 @@ import ( "io" "net/http" - "github.com/mattermost/mattermost-server/v5/model" "github.com/pkg/errors" + + "github.com/mattermost/mattermost-server/v5/model" ) const permissionsExportBatchSize = 100 diff --git a/app/permissions_migrations_test.go b/app/permissions_migrations_test.go index 0332f3514cb..ec4bb168f26 100644 --- a/app/permissions_migrations_test.go +++ b/app/permissions_migrations_test.go @@ -7,8 +7,9 @@ import ( "sort" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestApplyPermissionsMap(t *testing.T) { diff --git a/app/permissions_test.go b/app/permissions_test.go index 5c703fa25e6..d6c49350bed 100644 --- a/app/permissions_test.go +++ b/app/permissions_test.go @@ -9,9 +9,10 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) type testWriter struct { diff --git a/app/plugin.go b/app/plugin.go index 94d59ec0135..52da0ccb7a5 100644 --- a/app/plugin.go +++ b/app/plugin.go @@ -16,16 +16,16 @@ import ( "strings" "sync" + "github.com/blang/semver" + svg "github.com/h2non/go-is-svg" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/services/filesstore" "github.com/mattermost/mattermost-server/v5/services/marketplace" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - - "github.com/blang/semver" - svg "github.com/h2non/go-is-svg" - "github.com/pkg/errors" ) const prepackagedPluginsDir = "prepackaged_plugins" diff --git a/app/plugin_api_test.go b/app/plugin_api_test.go index 5948e7cd598..e1cc4e7b40d 100644 --- a/app/plugin_api_test.go +++ b/app/plugin_api_test.go @@ -21,15 +21,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/einterfaces/mocks" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func getDefaultPluginSettingsSchema() string { diff --git a/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go b/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go index c235b0a05e9..24e1f4c392f 100644 --- a/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go +++ b/app/plugin_api_tests/manual.test_http_upgrade_websocket_plugin/main.go @@ -7,10 +7,10 @@ import ( "bytes" "net/http" + "github.com/gorilla/websocket" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" - - "github.com/gorilla/websocket" ) type Plugin struct { diff --git a/app/plugin_api_tests/test_call_log_api_plugin/main.go b/app/plugin_api_tests/test_call_log_api_plugin/main.go index 23880d4980c..7ad3b42716f 100644 --- a/app/plugin_api_tests/test_call_log_api_plugin/main.go +++ b/app/plugin_api_tests/test_call_log_api_plugin/main.go @@ -4,9 +4,10 @@ package main import ( + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" - "github.com/pkg/errors" ) type PluginUsingLogAPI struct { diff --git a/app/plugin_commands.go b/app/plugin_commands.go index cbf6069001e..bf7a96adae4 100644 --- a/app/plugin_commands.go +++ b/app/plugin_commands.go @@ -9,8 +9,9 @@ import ( "net/url" "strings" - "github.com/mattermost/mattermost-server/v5/model" "github.com/pkg/errors" + + "github.com/mattermost/mattermost-server/v5/model" ) type PluginCommand struct { diff --git a/app/plugin_commands_test.go b/app/plugin_commands_test.go index 635c316f8ac..e19871e0435 100644 --- a/app/plugin_commands_test.go +++ b/app/plugin_commands_test.go @@ -7,9 +7,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/require" ) func TestPluginCommand(t *testing.T) { diff --git a/app/plugin_context.go b/app/plugin_context.go index fbf2de4cd22..0ac6e08eb94 100644 --- a/app/plugin_context.go +++ b/app/plugin_context.go @@ -3,7 +3,9 @@ package app -import "github.com/mattermost/mattermost-server/v5/plugin" +import ( + "github.com/mattermost/mattermost-server/v5/plugin" +) func (a *App) PluginContext() *plugin.Context { context := &plugin.Context{ diff --git a/app/plugin_health_check_test.go b/app/plugin_health_check_test.go index 8be5fa66a44..222792f7db1 100644 --- a/app/plugin_health_check_test.go +++ b/app/plugin_health_check_test.go @@ -6,9 +6,10 @@ package app import ( "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" - "github.com/stretchr/testify/require" ) func TestHealthCheckJob(t *testing.T) { diff --git a/app/plugin_hooks_test.go b/app/plugin_hooks_test.go index 39b96d22cea..02bb0d0f02a 100644 --- a/app/plugin_hooks_test.go +++ b/app/plugin_hooks_test.go @@ -15,16 +15,15 @@ import ( "time" "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/einterfaces/mocks" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/plugin/plugintest" "github.com/mattermost/mattermost-server/v5/utils" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func SetAppEnvironmentWithPlugins(t *testing.T, pluginCode []string, app *App, apiFunc func(*model.Manifest) plugin.API) (func(), []string, []error) { diff --git a/app/plugin_install_test.go b/app/plugin_install_test.go index 74b7c572755..d25a7eeabdc 100644 --- a/app/plugin_install_test.go +++ b/app/plugin_install_test.go @@ -13,11 +13,11 @@ import ( "sort" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/utils/fileutils" ) type nilReadSeeker struct { diff --git a/app/plugin_requests.go b/app/plugin_requests.go index 47721f11013..7e0a64ed149 100644 --- a/app/plugin_requests.go +++ b/app/plugin_requests.go @@ -4,16 +4,16 @@ package app import ( + "bytes" "fmt" + "io/ioutil" "net/http" "path" "path/filepath" "strings" - "bytes" - "io/ioutil" - "github.com/gorilla/mux" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" diff --git a/app/plugin_signature.go b/app/plugin_signature.go index c3d1ef8062f..8e75561c48a 100644 --- a/app/plugin_signature.go +++ b/app/plugin_signature.go @@ -10,12 +10,13 @@ import ( "net/http" "path/filepath" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/utils" "github.com/pkg/errors" "golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp/armor" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/utils" ) // GetPluginPublicKeyFiles returns all public keys listed in the config. diff --git a/app/plugin_signature_test.go b/app/plugin_signature_test.go index 9340f637029..84aa97ca473 100644 --- a/app/plugin_signature_test.go +++ b/app/plugin_signature_test.go @@ -9,11 +9,12 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" ) func TestPluginPublicKeys(t *testing.T) { diff --git a/app/post_metadata.go b/app/post_metadata.go index 2c97cacf21b..8f75ec220b5 100644 --- a/app/post_metadata.go +++ b/app/post_metadata.go @@ -15,6 +15,7 @@ import ( "time" "github.com/dyatlov/go-opengraph/opengraph" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/cache" diff --git a/app/post_metadata_test.go b/app/post_metadata_test.go index 1cbf3a9f0f7..e96c3874570 100644 --- a/app/post_metadata_test.go +++ b/app/post_metadata_test.go @@ -19,12 +19,13 @@ import ( "time" "github.com/dyatlov/go-opengraph/opengraph" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/httpservice" "github.com/mattermost/mattermost-server/v5/services/imageproxy" "github.com/mattermost/mattermost-server/v5/utils/testutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPreparePostListForClient(t *testing.T) { diff --git a/app/product_notices.go b/app/product_notices.go index 1c65bce59ad..d8af43be3bd 100644 --- a/app/product_notices.go +++ b/app/product_notices.go @@ -11,15 +11,15 @@ import ( "strings" "time" + "github.com/Masterminds/semver/v3" + "github.com/pkg/errors" + date_constraints "github.com/reflog/dateconstraints" + "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" - - "github.com/Masterminds/semver/v3" - "github.com/pkg/errors" - date_constraints "github.com/reflog/dateconstraints" ) const MaxRepeatViewings = 3 diff --git a/app/product_notices_test.go b/app/product_notices_test.go index c6984cf09c1..3fa34c00715 100644 --- a/app/product_notices_test.go +++ b/app/product_notices_test.go @@ -12,9 +12,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/require" ) func TestNoticeValidation(t *testing.T) { diff --git a/app/ratelimit.go b/app/ratelimit.go index 8f11aff686a..39c21514338 100644 --- a/app/ratelimit.go +++ b/app/ratelimit.go @@ -9,12 +9,13 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/utils" "github.com/pkg/errors" "github.com/throttled/throttled" "github.com/throttled/throttled/store/memstore" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/utils" ) type RateLimiter struct { diff --git a/app/ratelimit_test.go b/app/ratelimit_test.go index 99dd9834873..00126fc59d3 100644 --- a/app/ratelimit_test.go +++ b/app/ratelimit_test.go @@ -9,8 +9,9 @@ import ( "strconv" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func genRateLimitSettings(useAuth, useIP bool, header string) *model.RateLimitSettings { diff --git a/app/role_test.go b/app/role_test.go index eda886fd2f0..7b72ec437ad 100644 --- a/app/role_test.go +++ b/app/role_test.go @@ -11,9 +11,10 @@ import ( "strings" "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/require" ) type permissionInheritanceTestData struct { diff --git a/app/server.go b/app/server.go index ee3459a6dd2..9cc97a369cb 100644 --- a/app/server.go +++ b/app/server.go @@ -28,7 +28,6 @@ import ( "github.com/gorilla/mux" "github.com/pkg/errors" "github.com/rs/cors" - "golang.org/x/crypto/acme/autocert" "github.com/mattermost/mattermost-server/v5/audit" diff --git a/app/server_license.go b/app/server_license.go index 54b3c2fead8..ded5d93cfef 100644 --- a/app/server_license.go +++ b/app/server_license.go @@ -3,7 +3,9 @@ package app -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) func (s *Server) License() *model.License { license, _ := s.licenseValue.Load().(*model.License) diff --git a/app/server_test.go b/app/server_test.go index 794aaf73cab..f454a6fa1ac 100644 --- a/app/server_test.go +++ b/app/server_test.go @@ -21,13 +21,13 @@ import ( "time" "github.com/getsentry/sentry-go" - "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/config" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/require" ) func TestStartServerSuccess(t *testing.T) { diff --git a/app/session_test.go b/app/session_test.go index b174e39b193..6c3b4a7c13c 100644 --- a/app/session_test.go +++ b/app/session_test.go @@ -9,9 +9,10 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCache(t *testing.T) { diff --git a/app/slack.go b/app/slack.go index de19d75f136..6449cd2acfe 100644 --- a/app/slack.go +++ b/app/slack.go @@ -5,10 +5,9 @@ package app import ( "bytes" + "fmt" "mime/multipart" "regexp" - - "fmt" "strings" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/slashcommands/command_away.go b/app/slashcommands/command_away.go index 86664f2a11f..8a343a33e2d 100644 --- a/app/slashcommands/command_away.go +++ b/app/slashcommands/command_away.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_code.go b/app/slashcommands/command_code.go index 461a013f1e8..8d908e98e27 100644 --- a/app/slashcommands/command_code.go +++ b/app/slashcommands/command_code.go @@ -7,6 +7,7 @@ import ( "strings" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_dnd.go b/app/slashcommands/command_dnd.go index 00406b19eae..66e9573c854 100644 --- a/app/slashcommands/command_dnd.go +++ b/app/slashcommands/command_dnd.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_echo.go b/app/slashcommands/command_echo.go index 9dc6c0e5f23..b21e87e5830 100644 --- a/app/slashcommands/command_echo.go +++ b/app/slashcommands/command_echo.go @@ -9,6 +9,7 @@ import ( "time" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/slashcommands/command_expand_collapse.go b/app/slashcommands/command_expand_collapse.go index 6697ade7136..4794e9c795a 100644 --- a/app/slashcommands/command_expand_collapse.go +++ b/app/slashcommands/command_expand_collapse.go @@ -7,6 +7,7 @@ import ( "strconv" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_groupmsg.go b/app/slashcommands/command_groupmsg.go index 9eb9d687f6d..7a871db1a06 100644 --- a/app/slashcommands/command_groupmsg.go +++ b/app/slashcommands/command_groupmsg.go @@ -8,6 +8,7 @@ import ( "strings" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/slashcommands/command_help.go b/app/slashcommands/command_help.go index 2229c380364..2c4c94e05bd 100644 --- a/app/slashcommands/command_help.go +++ b/app/slashcommands/command_help.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_invite_people.go b/app/slashcommands/command_invite_people.go index 2f697e8e421..fcdd5cb7469 100644 --- a/app/slashcommands/command_invite_people.go +++ b/app/slashcommands/command_invite_people.go @@ -7,6 +7,7 @@ import ( "strings" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/slashcommands/command_join.go b/app/slashcommands/command_join.go index 246f0bddf1f..642f929554c 100644 --- a/app/slashcommands/command_join.go +++ b/app/slashcommands/command_join.go @@ -7,6 +7,7 @@ import ( "strings" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_leave.go b/app/slashcommands/command_leave.go index e98c9ceab82..20b6635c66d 100644 --- a/app/slashcommands/command_leave.go +++ b/app/slashcommands/command_leave.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_loadtest.go b/app/slashcommands/command_loadtest.go index 7893ad1b493..1ac2af0bb02 100644 --- a/app/slashcommands/command_loadtest.go +++ b/app/slashcommands/command_loadtest.go @@ -13,11 +13,12 @@ import ( "strings" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/pkg/errors" ) var usage = `Mattermost testing commands to help configure the system diff --git a/app/slashcommands/command_logout.go b/app/slashcommands/command_logout.go index a539f7f48ab..9ef21255170 100644 --- a/app/slashcommands/command_logout.go +++ b/app/slashcommands/command_logout.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_me.go b/app/slashcommands/command_me.go index d1f4d2587df..c008b7d0cc1 100644 --- a/app/slashcommands/command_me.go +++ b/app/slashcommands/command_me.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_msg.go b/app/slashcommands/command_msg.go index b10cddf304f..5edf6b0104d 100644 --- a/app/slashcommands/command_msg.go +++ b/app/slashcommands/command_msg.go @@ -8,6 +8,7 @@ import ( "strings" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/slashcommands/command_mute.go b/app/slashcommands/command_mute.go index 07354a2d23a..18c708af7b3 100644 --- a/app/slashcommands/command_mute.go +++ b/app/slashcommands/command_mute.go @@ -7,6 +7,7 @@ import ( "strings" goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_mute_test.go b/app/slashcommands/command_mute_test.go index 91a451b271f..14674ebf8f6 100644 --- a/app/slashcommands/command_mute_test.go +++ b/app/slashcommands/command_mute_test.go @@ -8,8 +8,9 @@ import ( "time" "github.com/mattermost/go-i18n/i18n" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestMuteCommandNoChannel(t *testing.T) { diff --git a/app/slashcommands/command_offline.go b/app/slashcommands/command_offline.go index a470e8d65d6..8b13d4e661e 100644 --- a/app/slashcommands/command_offline.go +++ b/app/slashcommands/command_offline.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_online.go b/app/slashcommands/command_online.go index 36efa960579..dc07a34e224 100644 --- a/app/slashcommands/command_online.go +++ b/app/slashcommands/command_online.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_open.go b/app/slashcommands/command_open.go index 074d72c97b6..927c46e64a6 100644 --- a/app/slashcommands/command_open.go +++ b/app/slashcommands/command_open.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_search.go b/app/slashcommands/command_search.go index 71659e3acbb..aaa79fdb05a 100644 --- a/app/slashcommands/command_search.go +++ b/app/slashcommands/command_search.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_settings.go b/app/slashcommands/command_settings.go index 8e3b3c3813b..311cb55741c 100644 --- a/app/slashcommands/command_settings.go +++ b/app/slashcommands/command_settings.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_shortcuts.go b/app/slashcommands/command_shortcuts.go index ed86da87afa..def6f9948c2 100644 --- a/app/slashcommands/command_shortcuts.go +++ b/app/slashcommands/command_shortcuts.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/command_shrug.go b/app/slashcommands/command_shrug.go index a48ba3bf589..0793f8ecb9b 100644 --- a/app/slashcommands/command_shrug.go +++ b/app/slashcommands/command_shrug.go @@ -5,6 +5,7 @@ package slashcommands import ( goi18n "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/app/slashcommands/helper_test.go b/app/slashcommands/helper_test.go index 36b66f7310e..697047292fd 100644 --- a/app/slashcommands/helper_test.go +++ b/app/slashcommands/helper_test.go @@ -10,9 +10,8 @@ import ( "path/filepath" "strings" "sync" - "time" - "testing" + "time" "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/config" diff --git a/app/status_test.go b/app/status_test.go index 7ad55eec980..994d1efd296 100644 --- a/app/status_test.go +++ b/app/status_test.go @@ -6,8 +6,9 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestSaveStatus(t *testing.T) { diff --git a/app/syncables_test.go b/app/syncables_test.go index 59cee493443..fe008574505 100644 --- a/app/syncables_test.go +++ b/app/syncables_test.go @@ -6,8 +6,9 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCreateDefaultMemberships(t *testing.T) { diff --git a/app/team.go b/app/team.go index d4799529f8f..9bec52d6144 100644 --- a/app/team.go +++ b/app/team.go @@ -17,6 +17,7 @@ import ( "strings" "github.com/disintegration/imaging" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" diff --git a/app/team_test.go b/app/team_test.go index fcba6bd4fbb..fddfd6a6533 100644 --- a/app/team_test.go +++ b/app/team_test.go @@ -10,11 +10,12 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" ) func TestCreateTeam(t *testing.T) { diff --git a/app/upload_test.go b/app/upload_test.go index 807b415200b..6116377f25d 100644 --- a/app/upload_test.go +++ b/app/upload_test.go @@ -13,10 +13,10 @@ import ( "sync/atomic" "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - - "github.com/stretchr/testify/require" ) func TestCreateUploadSession(t *testing.T) { diff --git a/app/user.go b/app/user.go index cdb549ebbaf..13ed467a190 100644 --- a/app/user.go +++ b/app/user.go @@ -27,6 +27,7 @@ import ( "github.com/disintegration/imaging" "github.com/golang/freetype" "github.com/golang/freetype/truetype" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/app/user_viewmembers_test.go b/app/user_viewmembers_test.go index 74a55092d19..c24db42b7d5 100644 --- a/app/user_viewmembers_test.go +++ b/app/user_viewmembers_test.go @@ -6,10 +6,11 @@ package app import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestResctrictedViewMembers(t *testing.T) { diff --git a/app/web_conn.go b/app/web_conn.go index 363e7c310e4..c48d41a09cb 100644 --- a/app/web_conn.go +++ b/app/web_conn.go @@ -11,11 +11,11 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/gorilla/websocket" goi18n "github.com/mattermost/go-i18n/i18n" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" ) const ( diff --git a/app/webhook_test.go b/app/webhook_test.go index b1a56cce826..06c7c6b8d98 100644 --- a/app/webhook_test.go +++ b/app/webhook_test.go @@ -13,10 +13,11 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/services/httpservice" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/services/httpservice" ) func TestCreateIncomingWebhookForChannel(t *testing.T) { diff --git a/app/webhub_fuzz.go b/app/webhub_fuzz.go index d73c30d4ab8..545b6346aa3 100644 --- a/app/webhub_fuzz.go +++ b/app/webhub_fuzz.go @@ -16,11 +16,11 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/testlib" - "github.com/gorilla/websocket" goi18n "github.com/mattermost/go-i18n/i18n" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/testlib" ) // This is a file used to fuzz test the web_hub code. diff --git a/audit/audit.go b/audit/audit.go index 61a606612d9..90a4b318609 100644 --- a/audit/audit.go +++ b/audit/audit.go @@ -9,6 +9,7 @@ import ( "github.com/mattermost/logr" "github.com/mattermost/logr/format" + "github.com/mattermost/mattermost-server/v5/mlog" ) diff --git a/cmd/mattermost/commands/channel.go b/cmd/mattermost/commands/channel.go index cac9715b672..f0d20ef50e7 100644 --- a/cmd/mattermost/commands/channel.go +++ b/cmd/mattermost/commands/channel.go @@ -6,11 +6,12 @@ package commands import ( "fmt" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" - "github.com/pkg/errors" - "github.com/spf13/cobra" ) var ChannelCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/channel_test.go b/cmd/mattermost/commands/channel_test.go index 6feac6e3d31..d6f77dd0bce 100644 --- a/cmd/mattermost/commands/channel_test.go +++ b/cmd/mattermost/commands/channel_test.go @@ -8,9 +8,10 @@ import ( "strings" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestJoinChannel(t *testing.T) { diff --git a/cmd/mattermost/commands/command.go b/cmd/mattermost/commands/command.go index 5c03cd88e1d..a0f673cd651 100644 --- a/cmd/mattermost/commands/command.go +++ b/cmd/mattermost/commands/command.go @@ -5,14 +5,14 @@ package commands import ( "errors" + "fmt" "strings" - "fmt" + "github.com/spf13/cobra" "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" - "github.com/spf13/cobra" ) var CommandCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/command_test.go b/cmd/mattermost/commands/command_test.go index 8db3d6d8026..e8cdd5d63d3 100644 --- a/cmd/mattermost/commands/command_test.go +++ b/cmd/mattermost/commands/command_test.go @@ -6,9 +6,10 @@ package commands import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCreateCommand(t *testing.T) { diff --git a/cmd/mattermost/commands/db.go b/cmd/mattermost/commands/db.go index 5a3685b2137..d8cc1758b70 100644 --- a/cmd/mattermost/commands/db.go +++ b/cmd/mattermost/commands/db.go @@ -6,11 +6,11 @@ package commands import ( "fmt" - "github.com/mattermost/mattermost-server/v5/config" - "github.com/mattermost/mattermost-server/v5/store/sqlstore" - "github.com/pkg/errors" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/config" + "github.com/mattermost/mattermost-server/v5/store/sqlstore" ) var DbCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/export.go b/cmd/mattermost/commands/export.go index 5aee98b0a96..07e4fb06526 100644 --- a/cmd/mattermost/commands/export.go +++ b/cmd/mattermost/commands/export.go @@ -9,10 +9,11 @@ import ( "os" "time" - "github.com/mattermost/mattermost-server/v5/audit" - "github.com/mattermost/mattermost-server/v5/model" "github.com/pkg/errors" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/audit" + "github.com/mattermost/mattermost-server/v5/model" ) var ExportCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/group.go b/cmd/mattermost/commands/group.go index 4836729a7dd..1670c53da0d 100644 --- a/cmd/mattermost/commands/group.go +++ b/cmd/mattermost/commands/group.go @@ -6,11 +6,11 @@ package commands import ( "fmt" - "github.com/mattermost/mattermost-server/v5/audit" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/pkg/errors" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/audit" + "github.com/mattermost/mattermost-server/v5/model" ) var GroupCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/group_test.go b/cmd/mattermost/commands/group_test.go index abe9229f13e..f1444d6bf7b 100644 --- a/cmd/mattermost/commands/group_test.go +++ b/cmd/mattermost/commands/group_test.go @@ -6,8 +6,9 @@ package commands import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestChannelGroupEnable(t *testing.T) { diff --git a/cmd/mattermost/commands/import.go b/cmd/mattermost/commands/import.go index ae877c08186..46c9b9351a3 100644 --- a/cmd/mattermost/commands/import.go +++ b/cmd/mattermost/commands/import.go @@ -5,12 +5,12 @@ package commands import ( "errors" + "fmt" "os" - "fmt" + "github.com/spf13/cobra" "github.com/mattermost/mattermost-server/v5/audit" - "github.com/spf13/cobra" ) var ImportCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/init.go b/cmd/mattermost/commands/init.go index ba468aeef01..5c24f87a817 100644 --- a/cmd/mattermost/commands/init.go +++ b/cmd/mattermost/commands/init.go @@ -4,11 +4,12 @@ package commands import ( + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/spf13/cobra" ) func InitDBCommandContextCobra(command *cobra.Command) (*app.App, error) { diff --git a/cmd/mattermost/commands/integrity.go b/cmd/mattermost/commands/integrity.go index d48ab525619..5cf603b1ada 100644 --- a/cmd/mattermost/commands/integrity.go +++ b/cmd/mattermost/commands/integrity.go @@ -8,8 +8,9 @@ import ( "os" "strings" - "github.com/mattermost/mattermost-server/v5/model" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/model" ) var IntegrityCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/jobserver.go b/cmd/mattermost/commands/jobserver.go index 1bb56284e52..177684ededf 100644 --- a/cmd/mattermost/commands/jobserver.go +++ b/cmd/mattermost/commands/jobserver.go @@ -8,10 +8,11 @@ import ( "os/signal" "syscall" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/spf13/cobra" ) var JobserverCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/ldap.go b/cmd/mattermost/commands/ldap.go index d69416a1d70..3f80de269de 100644 --- a/cmd/mattermost/commands/ldap.go +++ b/cmd/mattermost/commands/ldap.go @@ -4,9 +4,10 @@ package commands import ( + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" - "github.com/spf13/cobra" ) var LdapCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/license.go b/cmd/mattermost/commands/license.go index 4c555d59894..5395e2ffe2b 100644 --- a/cmd/mattermost/commands/license.go +++ b/cmd/mattermost/commands/license.go @@ -7,8 +7,9 @@ import ( "errors" "io/ioutil" - "github.com/mattermost/mattermost-server/v5/audit" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/audit" ) var LicenseCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/logs.go b/cmd/mattermost/commands/logs.go index 2e560f8a4a1..03422994560 100644 --- a/cmd/mattermost/commands/logs.go +++ b/cmd/mattermost/commands/logs.go @@ -7,8 +7,9 @@ import ( "io" "os" - "github.com/mattermost/mattermost-server/v5/mlog/human" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/mlog/human" ) var LogsCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/plugin.go b/cmd/mattermost/commands/plugin.go index da16474c579..d0af4a6a100 100644 --- a/cmd/mattermost/commands/plugin.go +++ b/cmd/mattermost/commands/plugin.go @@ -8,10 +8,11 @@ import ( "os" "path/filepath" - "github.com/mattermost/mattermost-server/v5/audit" - "github.com/mattermost/mattermost-server/v5/model" "github.com/pkg/errors" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/audit" + "github.com/mattermost/mattermost-server/v5/model" ) var PluginCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/plugin_test.go b/cmd/mattermost/commands/plugin_test.go index 7ce44f86534..4e388ee928c 100644 --- a/cmd/mattermost/commands/plugin_test.go +++ b/cmd/mattermost/commands/plugin_test.go @@ -7,10 +7,11 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v5/config" - "github.com/mattermost/mattermost-server/v5/utils/fileutils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/config" + "github.com/mattermost/mattermost-server/v5/utils/fileutils" ) func TestPlugin(t *testing.T) { diff --git a/cmd/mattermost/commands/reset.go b/cmd/mattermost/commands/reset.go index 42d0f67df6c..e8e9c21ce0c 100644 --- a/cmd/mattermost/commands/reset.go +++ b/cmd/mattermost/commands/reset.go @@ -7,8 +7,9 @@ import ( "errors" "fmt" - "github.com/mattermost/mattermost-server/v5/audit" "github.com/spf13/cobra" + + "github.com/mattermost/mattermost-server/v5/audit" ) var ResetCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/sampledata.go b/cmd/mattermost/commands/sampledata.go index 0f86fe96008..676ba677b7b 100644 --- a/cmd/mattermost/commands/sampledata.go +++ b/cmd/mattermost/commands/sampledata.go @@ -16,11 +16,12 @@ import ( "time" "github.com/icrowley/fake" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/spf13/cobra" ) const ( diff --git a/cmd/mattermost/commands/server.go b/cmd/mattermost/commands/server.go index a37f530632a..2c7f1dee52f 100644 --- a/cmd/mattermost/commands/server.go +++ b/cmd/mattermost/commands/server.go @@ -10,6 +10,9 @@ import ( "runtime/debug" "syscall" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/api4" "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/config" @@ -18,8 +21,6 @@ import ( "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/web" "github.com/mattermost/mattermost-server/v5/wsapi" - "github.com/pkg/errors" - "github.com/spf13/cobra" ) var serverCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/server_test.go b/cmd/mattermost/commands/server_test.go index 3f16ea713b2..a468b85561d 100644 --- a/cmd/mattermost/commands/server_test.go +++ b/cmd/mattermost/commands/server_test.go @@ -10,9 +10,10 @@ import ( "syscall" "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/jobs" - "github.com/stretchr/testify/require" ) const ( diff --git a/cmd/mattermost/commands/team.go b/cmd/mattermost/commands/team.go index 3915b3380a2..e2c863be569 100644 --- a/cmd/mattermost/commands/team.go +++ b/cmd/mattermost/commands/team.go @@ -9,10 +9,11 @@ import ( "sort" "strings" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" - "github.com/spf13/cobra" ) var TeamCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/team_test.go b/cmd/mattermost/commands/team_test.go index ac7a9f0472d..799cfc5c8fd 100644 --- a/cmd/mattermost/commands/team_test.go +++ b/cmd/mattermost/commands/team_test.go @@ -6,9 +6,10 @@ package commands import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCreateTeam(t *testing.T) { diff --git a/cmd/mattermost/commands/test.go b/cmd/mattermost/commands/test.go index 51d259c6085..0d5b0687058 100644 --- a/cmd/mattermost/commands/test.go +++ b/cmd/mattermost/commands/test.go @@ -8,15 +8,15 @@ import ( "fmt" "os" "os/exec" - "os/signal" "syscall" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/api4" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/wsapi" - "github.com/spf13/cobra" ) var TestCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/user.go b/cmd/mattermost/commands/user.go index d69ec602d3a..edb21f8f3f4 100644 --- a/cmd/mattermost/commands/user.go +++ b/cmd/mattermost/commands/user.go @@ -10,10 +10,11 @@ import ( "io/ioutil" "strings" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" - "github.com/spf13/cobra" ) var UserCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/user_test.go b/cmd/mattermost/commands/user_test.go index 82dd2aa7a6c..375a5c5d814 100644 --- a/cmd/mattermost/commands/user_test.go +++ b/cmd/mattermost/commands/user_test.go @@ -6,8 +6,9 @@ package commands import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCreateUserWithTeam(t *testing.T) { diff --git a/cmd/mattermost/commands/utils.go b/cmd/mattermost/commands/utils.go index f3c56f93658..9244a824d12 100644 --- a/cmd/mattermost/commands/utils.go +++ b/cmd/mattermost/commands/utils.go @@ -12,9 +12,10 @@ import ( "sort" "strings" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" - "github.com/spf13/cobra" ) const CustomDefaultsEnvVar = "MM_CUSTOM_DEFAULTS_PATH" diff --git a/cmd/mattermost/commands/version.go b/cmd/mattermost/commands/version.go index 9649a4842fd..aaf1b898395 100644 --- a/cmd/mattermost/commands/version.go +++ b/cmd/mattermost/commands/version.go @@ -4,9 +4,10 @@ package commands import ( + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" - "github.com/spf13/cobra" ) var VersionCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/webhook.go b/cmd/mattermost/commands/webhook.go index 06d46e00d85..52f359626a2 100644 --- a/cmd/mattermost/commands/webhook.go +++ b/cmd/mattermost/commands/webhook.go @@ -8,11 +8,12 @@ import ( "net/http" "strings" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/mattermost/mattermost-server/v5/audit" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/pkg/errors" - "github.com/spf13/cobra" ) var WebhookCmd = &cobra.Command{ diff --git a/cmd/mattermost/commands/webhook_test.go b/cmd/mattermost/commands/webhook_test.go index 0729fde7def..dc853500d8e 100644 --- a/cmd/mattermost/commands/webhook_test.go +++ b/cmd/mattermost/commands/webhook_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/api4" diff --git a/cmd/mattermost/main.go b/cmd/mattermost/main.go index 7c26a34f683..2d7a307771a 100644 --- a/cmd/mattermost/main.go +++ b/cmd/mattermost/main.go @@ -6,17 +6,6 @@ package main import ( "os" - "github.com/mattermost/mattermost-server/v5/cmd/mattermost/commands" - - // Import and register app layer slash commands - _ "github.com/mattermost/mattermost-server/v5/app/slashcommands" - - // Plugins - _ "github.com/mattermost/mattermost-server/v5/model/gitlab" - - // Enterprise Imports - _ "github.com/mattermost/mattermost-server/v5/imports" - // Enterprise Deps _ "github.com/gorilla/handlers" _ "github.com/hako/durafmt" @@ -28,6 +17,14 @@ import ( _ "github.com/prometheus/client_golang/prometheus/promhttp" _ "github.com/tylerb/graceful" _ "gopkg.in/olivere/elastic.v6" + + "github.com/mattermost/mattermost-server/v5/cmd/mattermost/commands" + // Import and register app layer slash commands + _ "github.com/mattermost/mattermost-server/v5/app/slashcommands" + // Plugins + _ "github.com/mattermost/mattermost-server/v5/model/gitlab" + // Enterprise Imports + _ "github.com/mattermost/mattermost-server/v5/imports" ) func main() { diff --git a/config/common_test.go b/config/common_test.go index a3cc7f4133a..5deef2b67a5 100644 --- a/config/common_test.go +++ b/config/common_test.go @@ -7,10 +7,10 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v5/config" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/config/database.go b/config/database.go index 56e5a0fa57d..5cb24fa57ae 100644 --- a/config/database.go +++ b/config/database.go @@ -12,13 +12,13 @@ import ( "github.com/jmoiron/sqlx" "github.com/pkg/errors" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" - // Load the MySQL driver _ "github.com/go-sql-driver/mysql" // Load the Postgres driver _ "github.com/lib/pq" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" ) // MaxWriteLength defines the maximum length accepted for write to the Configurations or diff --git a/config/default_test.go b/config/default_test.go index abdb9aab7ec..1d5315ae1f1 100644 --- a/config/default_test.go +++ b/config/default_test.go @@ -9,10 +9,10 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v5/model" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/config/config_generator/generator" - "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" ) func TestDefaultsGenerator(t *testing.T) { diff --git a/config/environment_test.go b/config/environment_test.go index 213d30c256d..d93eb81e0aa 100644 --- a/config/environment_test.go +++ b/config/environment_test.go @@ -6,8 +6,9 @@ package config import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func modifiedDefault(modify func(*model.Config)) *model.Config { diff --git a/config/export_test.go b/config/export_test.go index dbfff3e4647..d0a46eba358 100644 --- a/config/export_test.go +++ b/config/export_test.go @@ -5,6 +5,7 @@ package config import ( "github.com/jmoiron/sqlx" + "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/config/feature_flags.go b/config/feature_flags.go index 3b627280114..c0fece06ae3 100644 --- a/config/feature_flags.go +++ b/config/feature_flags.go @@ -9,11 +9,12 @@ import ( "strconv" "strings" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" "github.com/pkg/errors" "github.com/splitio/go-client/v6/splitio/client" "github.com/splitio/go-client/v6/splitio/conf" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" ) type FeatureFlagSyncParams struct { diff --git a/config/feature_flags_test.go b/config/feature_flags_test.go index 8d5fe141b6c..aa6bcaef108 100644 --- a/config/feature_flags_test.go +++ b/config/feature_flags_test.go @@ -6,8 +6,9 @@ package config import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestGetStructFields(t *testing.T) { diff --git a/config/main_test.go b/config/main_test.go index 52a27500631..6719b59ee58 100644 --- a/config/main_test.go +++ b/config/main_test.go @@ -9,10 +9,11 @@ import ( "github.com/go-sql-driver/mysql" "github.com/lib/pq" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/testlib" - "github.com/stretchr/testify/require" ) var mainHelper *testlib.MainHelper diff --git a/config/migrate.go b/config/migrate.go index d3f66bbf3a8..44b116db000 100644 --- a/config/migrate.go +++ b/config/migrate.go @@ -3,7 +3,9 @@ package config -import "github.com/pkg/errors" +import ( + "github.com/pkg/errors" +) // Migrate migrates SAML keys, certificates, and other config files from one store to another given their data source names. func Migrate(from, to string) error { diff --git a/config/migrate_test.go b/config/migrate_test.go index 0b1d1f0ba07..52844fbc6c7 100644 --- a/config/migrate_test.go +++ b/config/migrate_test.go @@ -9,10 +9,11 @@ import ( "path" "testing" - "github.com/mattermost/mattermost-server/v5/config" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/config" + "github.com/mattermost/mattermost-server/v5/model" ) func TestMigrate(t *testing.T) { diff --git a/config/store.go b/config/store.go index 7f8de4906da..5e70bcfb120 100644 --- a/config/store.go +++ b/config/store.go @@ -8,9 +8,10 @@ import ( "encoding/json" "sync" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/jsonutils" - "github.com/pkg/errors" ) // Listener is a callback function invoked when the configuration changes. diff --git a/config/store_test.go b/config/store_test.go index eaf9253befc..6b586b8d47d 100644 --- a/config/store_test.go +++ b/config/store_test.go @@ -9,8 +9,9 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v5/config" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/config" ) func TestNewStore(t *testing.T) { diff --git a/config/utils_test.go b/config/utils_test.go index 753319f5614..472aefaf1e6 100644 --- a/config/utils_test.go +++ b/config/utils_test.go @@ -6,9 +6,10 @@ package config import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" ) func TestDesanitize(t *testing.T) { diff --git a/einterfaces/account_migration.go b/einterfaces/account_migration.go index 2f59c28683d..d16412c7588 100644 --- a/einterfaces/account_migration.go +++ b/einterfaces/account_migration.go @@ -3,7 +3,9 @@ package einterfaces -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) type AccountMigrationInterface interface { MigrateToLdap(fromAuthService string, forignUserFieldNameToMatch string, force bool, dryRun bool) *model.AppError diff --git a/einterfaces/jobs/cloud_interface.go b/einterfaces/jobs/cloud_interface.go index 7a70e2a0d52..1ebd77d671c 100644 --- a/einterfaces/jobs/cloud_interface.go +++ b/einterfaces/jobs/cloud_interface.go @@ -3,7 +3,9 @@ package jobs -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) type CloudJobInterface interface { MakeWorker() model.Worker diff --git a/einterfaces/metrics.go b/einterfaces/metrics.go index 63f6521f94f..5c0f91ded9d 100644 --- a/einterfaces/metrics.go +++ b/einterfaces/metrics.go @@ -3,7 +3,9 @@ package einterfaces -import "github.com/mattermost/logr" +import ( + "github.com/mattermost/logr" +) type MetricsInterface interface { StartServer() diff --git a/jobs/interfaces/active_users_interface.go b/jobs/interfaces/active_users_interface.go index dad1450b321..286072ba4ad 100644 --- a/jobs/interfaces/active_users_interface.go +++ b/jobs/interfaces/active_users_interface.go @@ -3,7 +3,9 @@ package interfaces -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) type ActiveUsersJobInterface interface { MakeWorker() model.Worker diff --git a/jobs/interfaces/expirynotify_interface.go b/jobs/interfaces/expirynotify_interface.go index 854c2a61ac8..d47305bb646 100644 --- a/jobs/interfaces/expirynotify_interface.go +++ b/jobs/interfaces/expirynotify_interface.go @@ -3,7 +3,9 @@ package interfaces -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) type ExpiryNotifyJobInterface interface { MakeWorker() model.Worker diff --git a/jobs/interfaces/migrations_interface.go b/jobs/interfaces/migrations_interface.go index 3184d1799ad..879df39ea13 100644 --- a/jobs/interfaces/migrations_interface.go +++ b/jobs/interfaces/migrations_interface.go @@ -3,7 +3,9 @@ package interfaces -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) type MigrationsJobInterface interface { MakeWorker() model.Worker diff --git a/jobs/interfaces/plugins_interface.go b/jobs/interfaces/plugins_interface.go index a2863f35980..2a2bcf5bc88 100644 --- a/jobs/interfaces/plugins_interface.go +++ b/jobs/interfaces/plugins_interface.go @@ -3,7 +3,9 @@ package interfaces -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) type PluginsJobInterface interface { MakeWorker() model.Worker diff --git a/jobs/interfaces/product_notices_interface.go b/jobs/interfaces/product_notices_interface.go index 5b012491726..a260bc7ace8 100644 --- a/jobs/interfaces/product_notices_interface.go +++ b/jobs/interfaces/product_notices_interface.go @@ -3,7 +3,9 @@ package interfaces -import "github.com/mattermost/mattermost-server/v5/model" +import ( + "github.com/mattermost/mattermost-server/v5/model" +) type ProductNoticesJobInterface interface { MakeWorker() model.Worker diff --git a/jobs/schedulers_test.go b/jobs/schedulers_test.go index 7a8a88c1fd8..13d51d7e8b8 100644 --- a/jobs/schedulers_test.go +++ b/jobs/schedulers_test.go @@ -9,9 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/mattermost/mattermost-server/v5/einterfaces/mocks" - "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/utils/testutils" ) diff --git a/mlog/errors.go b/mlog/errors.go index f8d589688c8..93762fda57e 100644 --- a/mlog/errors.go +++ b/mlog/errors.go @@ -3,7 +3,9 @@ package mlog -import "github.com/mattermost/logr" +import ( + "github.com/mattermost/logr" +) // onLoggerError is called when the logging system encounters an error, // such as a target not able to write records. The targets will keep trying diff --git a/mlog/log_test.go b/mlog/log_test.go index 3616c8107ff..491c6fb0aef 100644 --- a/mlog/log_test.go +++ b/mlog/log_test.go @@ -8,8 +8,9 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v5/mlog" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/mlog" ) // Test race condition when shutting down advanced logging. This test must run with the -race flag in order to verify diff --git a/mlog/sugar.go b/mlog/sugar.go index c00a8bbfc01..2368b085b7f 100644 --- a/mlog/sugar.go +++ b/mlog/sugar.go @@ -3,7 +3,9 @@ package mlog -import "go.uber.org/zap" +import ( + "go.uber.org/zap" +) // Made for the plugin interface, use the regular logger for other uses type SugarLogger struct { diff --git a/mlog/tcp.go b/mlog/tcp.go index dad20474fef..ffbd14f1053 100644 --- a/mlog/tcp.go +++ b/mlog/tcp.go @@ -9,13 +9,12 @@ import ( "errors" "fmt" "net" + _ "net/http/pprof" "sync" "time" "github.com/hashicorp/go-multierror" "github.com/mattermost/logr" - - _ "net/http/pprof" ) const ( diff --git a/model/auditconv.go b/model/auditconv.go index 50af2880341..24a8d94df04 100644 --- a/model/auditconv.go +++ b/model/auditconv.go @@ -3,7 +3,9 @@ package model -import "github.com/francoispqt/gojay" +import ( + "github.com/francoispqt/gojay" +) // AuditModelTypeConv converts key model types to something better suited for audit output. func AuditModelTypeConv(val interface{}) (newVal interface{}, converted bool) { diff --git a/model/bundle_info.go b/model/bundle_info.go index 429e1c3d52c..5954432e0a3 100644 --- a/model/bundle_info.go +++ b/model/bundle_info.go @@ -3,7 +3,9 @@ package model -import "github.com/mattermost/mattermost-server/v5/mlog" +import ( + "github.com/mattermost/mattermost-server/v5/mlog" +) type BundleInfo struct { Path string diff --git a/model/config.go b/model/config.go index 8acd559c3e8..0a3bd1d1d61 100644 --- a/model/config.go +++ b/model/config.go @@ -19,6 +19,7 @@ import ( "time" "github.com/mattermost/ldap" + "github.com/mattermost/mattermost-server/v5/mlog" ) diff --git a/model/file_info.go b/model/file_info.go index 909bf9112e8..0c34731c63e 100644 --- a/model/file_info.go +++ b/model/file_info.go @@ -16,6 +16,7 @@ import ( "strings" "github.com/disintegration/imaging" + "github.com/mattermost/mattermost-server/v5/mlog" ) diff --git a/model/file_info_test.go b/model/file_info_test.go index 9e1467c2737..979f7dd91e8 100644 --- a/model/file_info_test.go +++ b/model/file_info_test.go @@ -6,13 +6,14 @@ package model import ( "bytes" "encoding/base64" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" _ "image/gif" _ "image/png" "io/ioutil" "strings" "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestFileInfoIsValid(t *testing.T) { diff --git a/model/initial_load_test.go b/model/initial_load_test.go index 7495dace555..56c446b7143 100644 --- a/model/initial_load_test.go +++ b/model/initial_load_test.go @@ -4,9 +4,10 @@ package model import ( - "github.com/stretchr/testify/require" "strings" "testing" + + "github.com/stretchr/testify/require" ) func TestInitialLoadJson(t *testing.T) { diff --git a/model/manifest_test.go b/model/manifest_test.go index fb07d51a629..90f1569bfc8 100644 --- a/model/manifest_test.go +++ b/model/manifest_test.go @@ -11,10 +11,9 @@ import ( "strings" "testing" - "gopkg.in/yaml.v2" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "gopkg.in/yaml.v2" ) func TestIsValid(t *testing.T) { diff --git a/model/product_notices.go b/model/product_notices.go index 6aa88fc7ec8..fae8ccb3ce9 100644 --- a/model/product_notices.go +++ b/model/product_notices.go @@ -5,8 +5,9 @@ package model import ( "encoding/json" - "github.com/pkg/errors" "io" + + "github.com/pkg/errors" ) type ProductNotices []ProductNotice diff --git a/model/token.go b/model/token.go index 0730778cd03..2dcf4143e0e 100644 --- a/model/token.go +++ b/model/token.go @@ -3,7 +3,9 @@ package model -import "net/http" +import ( + "net/http" +) const ( TOKEN_SIZE = 64 diff --git a/model/user.go b/model/user.go index c3f16d56ac4..4dbd002e837 100644 --- a/model/user.go +++ b/model/user.go @@ -18,9 +18,10 @@ import ( "time" "unicode/utf8" - "github.com/mattermost/mattermost-server/v5/services/timezones" "golang.org/x/crypto/bcrypt" "golang.org/x/text/language" + + "github.com/mattermost/mattermost-server/v5/services/timezones" ) const ( diff --git a/model/user_access_token_search_test.go b/model/user_access_token_search_test.go index 7e08f051c22..289a98a1290 100644 --- a/model/user_access_token_search_test.go +++ b/model/user_access_token_search_test.go @@ -4,9 +4,10 @@ package model import ( - "github.com/stretchr/testify/require" "strings" "testing" + + "github.com/stretchr/testify/require" ) func TestUserAccessTokenSearchJson(t *testing.T) { diff --git a/plugin/api.go b/plugin/api.go index caffd8becb3..8a5f58dbe1d 100644 --- a/plugin/api.go +++ b/plugin/api.go @@ -8,6 +8,7 @@ import ( "net/http" plugin "github.com/hashicorp/go-plugin" + "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/plugin/checker/check_helpers.go b/plugin/checker/check_helpers.go index 8c37507def4..94e7aa41f16 100644 --- a/plugin/checker/check_helpers.go +++ b/plugin/checker/check_helpers.go @@ -9,10 +9,10 @@ import ( "go/token" "go/types" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/plugin/checker/internal/asthelpers" "github.com/mattermost/mattermost-server/v5/plugin/checker/internal/version" - - "github.com/pkg/errors" ) func checkHelpersVersionComments(pkgPath string) (result, error) { diff --git a/plugin/client_rpc.go b/plugin/client_rpc.go index b8bf2d767cd..7d1f5cc5992 100644 --- a/plugin/client_rpc.go +++ b/plugin/client_rpc.go @@ -20,6 +20,7 @@ import ( "github.com/dyatlov/go-opengraph/opengraph" "github.com/hashicorp/go-plugin" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/plugin/environment.go b/plugin/environment.go index f22edff4e5d..c69be7f0741 100644 --- a/plugin/environment.go +++ b/plugin/environment.go @@ -12,11 +12,12 @@ import ( "sync" "time" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/pkg/errors" ) var ErrNotFound = errors.New("Item not found") diff --git a/plugin/environment_test.go b/plugin/environment_test.go index 3b996dc52c3..1494badb51e 100644 --- a/plugin/environment_test.go +++ b/plugin/environment_test.go @@ -9,8 +9,9 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestAvaliablePlugins(t *testing.T) { diff --git a/plugin/hclog_adapter.go b/plugin/hclog_adapter.go index f2bba2e70be..e79cee23167 100644 --- a/plugin/hclog_adapter.go +++ b/plugin/hclog_adapter.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/hashicorp/go-hclog" + "github.com/mattermost/mattermost-server/v5/mlog" ) diff --git a/plugin/health_check_test.go b/plugin/health_check_test.go index f19e4abb314..82335b0417e 100644 --- a/plugin/health_check_test.go +++ b/plugin/health_check_test.go @@ -10,10 +10,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/require" ) func TestPluginHealthCheck(t *testing.T) { diff --git a/plugin/helpers_bots_test.go b/plugin/helpers_bots_test.go index 622aa3023fd..850c9f9ab46 100644 --- a/plugin/helpers_bots_test.go +++ b/plugin/helpers_bots_test.go @@ -8,12 +8,13 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/assert" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/plugin/plugintest" "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/assert" ) func TestEnsureBot(t *testing.T) { diff --git a/plugin/helpers_config_test.go b/plugin/helpers_config_test.go index 79357e37ec6..263e2cf1e53 100644 --- a/plugin/helpers_config_test.go +++ b/plugin/helpers_config_test.go @@ -6,10 +6,11 @@ package plugin_test import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/plugin/plugintest" - "github.com/stretchr/testify/assert" ) func TestCheckRequiredServerConfiguration(t *testing.T) { diff --git a/plugin/helpers_kv_test.go b/plugin/helpers_kv_test.go index 801ebe4cc75..ae6018a1f40 100644 --- a/plugin/helpers_kv_test.go +++ b/plugin/helpers_kv_test.go @@ -7,10 +7,11 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/assert" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/plugin/plugintest" - "github.com/stretchr/testify/assert" ) func TestKVGetJSON(t *testing.T) { diff --git a/plugin/helpers_plugin.go b/plugin/helpers_plugin.go index 4b966a57704..1bb9e4705ee 100644 --- a/plugin/helpers_plugin.go +++ b/plugin/helpers_plugin.go @@ -10,8 +10,9 @@ import ( "time" "github.com/blang/semver" - "github.com/mattermost/mattermost-server/v5/model" "github.com/pkg/errors" + + "github.com/mattermost/mattermost-server/v5/model" ) // InstallPluginFromURL implements Helpers.InstallPluginFromURL. diff --git a/plugin/helpers_plugin_test.go b/plugin/helpers_plugin_test.go index 2dedbc873e6..ae5a7846eeb 100644 --- a/plugin/helpers_plugin_test.go +++ b/plugin/helpers_plugin_test.go @@ -10,13 +10,14 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" "github.com/mattermost/mattermost-server/v5/plugin/plugintest" "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestInstallPluginFromURL(t *testing.T) { diff --git a/plugin/stringifier_test.go b/plugin/stringifier_test.go index db40510b123..e81a3c1b14f 100644 --- a/plugin/stringifier_test.go +++ b/plugin/stringifier_test.go @@ -4,9 +4,10 @@ package plugin import ( + "testing" + "github.com/pkg/errors" "github.com/stretchr/testify/assert" - "testing" ) func TestStringify(t *testing.T) { diff --git a/plugin/supervisor.go b/plugin/supervisor.go index 8aef7f0a613..2ee4141f953 100644 --- a/plugin/supervisor.go +++ b/plugin/supervisor.go @@ -13,6 +13,7 @@ import ( "time" plugin "github.com/hashicorp/go-plugin" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" diff --git a/plugin/supervisor_test.go b/plugin/supervisor_test.go index ed4ebee72fc..d0a18a4d69d 100644 --- a/plugin/supervisor_test.go +++ b/plugin/supervisor_test.go @@ -9,11 +9,12 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestSupervisor(t *testing.T) { diff --git a/services/awsmeter/awsmeter.go b/services/awsmeter/awsmeter.go index c681fcc75df..20f7685bd8d 100644 --- a/services/awsmeter/awsmeter.go +++ b/services/awsmeter/awsmeter.go @@ -8,11 +8,6 @@ import ( "os" "time" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" - "github.com/pkg/errors" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" @@ -20,6 +15,11 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/marketplacemetering" "github.com/aws/aws-sdk-go/service/marketplacemetering/marketplacemeteringiface" + "github.com/pkg/errors" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) type AwsMeter struct { diff --git a/services/awsmeter/awsmeter_test.go b/services/awsmeter/awsmeter_test.go index 612e48f6535..21e278285e6 100644 --- a/services/awsmeter/awsmeter_test.go +++ b/services/awsmeter/awsmeter_test.go @@ -8,14 +8,14 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" - "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" + "github.com/aws/aws-sdk-go/service/marketplacemetering" + "github.com/aws/aws-sdk-go/service/marketplacemetering/marketplacemeteringiface" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/aws/aws-sdk-go/service/marketplacemetering" - "github.com/aws/aws-sdk-go/service/marketplacemetering/marketplacemeteringiface" + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" + "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" ) type mockMarketplaceMeteringClient struct { diff --git a/services/cache/lru.go b/services/cache/lru.go index 36265ba0e5e..75a0152f39c 100644 --- a/services/cache/lru.go +++ b/services/cache/lru.go @@ -8,10 +8,10 @@ import ( "sync" "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/tinylib/msgp/msgp" "github.com/vmihailenco/msgpack/v5" + + "github.com/mattermost/mattermost-server/v5/model" ) // LRU is a thread-safe fixed size LRU cache. diff --git a/services/cache/lru_striped_bench_test.go b/services/cache/lru_striped_bench_test.go index 74cc58b6934..4aab6e9bc37 100644 --- a/services/cache/lru_striped_bench_test.go +++ b/services/cache/lru_striped_bench_test.go @@ -9,9 +9,9 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v5/services/cache" - "github.com/cespare/xxhash/v2" + + "github.com/mattermost/mattermost-server/v5/services/cache" ) const ( diff --git a/services/cache/lru_striped_test.go b/services/cache/lru_striped_test.go index 2cfae041a4f..2dbdcf3f847 100644 --- a/services/cache/lru_striped_test.go +++ b/services/cache/lru_striped_test.go @@ -8,11 +8,11 @@ import ( "hash/maphash" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/cespare/xxhash/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func makeLRUPredictibleTestData(num int) [][2]string { diff --git a/services/cache/lru_test.go b/services/cache/lru_test.go index f7617e7beae..7eab51ffc58 100644 --- a/services/cache/lru_test.go +++ b/services/cache/lru_test.go @@ -9,9 +9,10 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestLRU(t *testing.T) { diff --git a/services/cache/mocks/Provider.go b/services/cache/mocks/Provider.go index d16d8a258ab..7515fc09cd1 100644 --- a/services/cache/mocks/Provider.go +++ b/services/cache/mocks/Provider.go @@ -3,8 +3,9 @@ package mocks import ( - cache "github.com/mattermost/mattermost-server/v5/services/cache" mock "github.com/stretchr/testify/mock" + + cache "github.com/mattermost/mattermost-server/v5/services/cache" ) // Provider is an autogenerated mock type for the Provider type diff --git a/services/cache/provider.go b/services/cache/provider.go index 0fa2040d4a1..406174e75ba 100644 --- a/services/cache/provider.go +++ b/services/cache/provider.go @@ -3,7 +3,9 @@ package cache -import "time" +import ( + "time" +) // CacheOptions contains options for initializaing a cache type CacheOptions struct { diff --git a/services/filesstore/s3store_test.go b/services/filesstore/s3store_test.go index 898e4ad1bb9..ddfc48e2d58 100644 --- a/services/filesstore/s3store_test.go +++ b/services/filesstore/s3store_test.go @@ -6,8 +6,9 @@ package filesstore import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCheckMandatoryS3Fields(t *testing.T) { diff --git a/services/imageproxy/atmos_camo_test.go b/services/imageproxy/atmos_camo_test.go index 923040fb772..d3dd4befd03 100644 --- a/services/imageproxy/atmos_camo_test.go +++ b/services/imageproxy/atmos_camo_test.go @@ -10,11 +10,12 @@ import ( "net/url" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/httpservice" "github.com/mattermost/mattermost-server/v5/utils/testutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func makeTestAtmosCamoProxy() *ImageProxy { diff --git a/services/imageproxy/local.go b/services/imageproxy/local.go index e1e32bfb750..144bf8428b8 100644 --- a/services/imageproxy/local.go +++ b/services/imageproxy/local.go @@ -14,9 +14,10 @@ import ( "net/url" "path/filepath" + "willnorris.com/go/imageproxy" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/services/httpservice" - "willnorris.com/go/imageproxy" ) var imageContentTypes = []string{ diff --git a/services/imageproxy/local_test.go b/services/imageproxy/local_test.go index 1837777a7e8..e7d57ded950 100644 --- a/services/imageproxy/local_test.go +++ b/services/imageproxy/local_test.go @@ -10,11 +10,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/httpservice" "github.com/mattermost/mattermost-server/v5/utils/testutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func makeTestLocalProxy() *ImageProxy { diff --git a/services/mailservice/mail.go b/services/mailservice/mail.go index f9ff1e0421c..ab0a55c5c0a 100644 --- a/services/mailservice/mail.go +++ b/services/mailservice/mail.go @@ -10,15 +10,14 @@ import ( "io" "mime" "net" + "net/http" "net/mail" "net/smtp" "time" + "github.com/jaytaylor/html2text" gomail "gopkg.in/mail.v2" - "net/http" - - "github.com/jaytaylor/html2text" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/filesstore" diff --git a/services/mailservice/mail_test.go b/services/mailservice/mail_test.go index b503a46c440..be7e237aa07 100644 --- a/services/mailservice/mail_test.go +++ b/services/mailservice/mail_test.go @@ -10,20 +10,20 @@ import ( "io" "io/ioutil" "net" + "net/mail" + "net/smtp" "os" "strings" "testing" "time" - "net/mail" - "net/smtp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/filesstore" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestMailConnectionFromConfig(t *testing.T) { diff --git a/services/marketplace/client.go b/services/marketplace/client.go index 3e68484a40b..a2bc6faccb2 100644 --- a/services/marketplace/client.go +++ b/services/marketplace/client.go @@ -11,9 +11,10 @@ import ( "net/url" "strings" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/httpservice" - "github.com/pkg/errors" ) // Client is the programmatic interface to the marketplace server API. diff --git a/services/mfa/mfa.go b/services/mfa/mfa.go index d8bd3ce2771..2748f0be7a8 100644 --- a/services/mfa/mfa.go +++ b/services/mfa/mfa.go @@ -10,10 +10,11 @@ import ( "strings" "github.com/dgryski/dgoogauth" + "github.com/mattermost/rsc/qr" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/configservice" "github.com/mattermost/mattermost-server/v5/store" - "github.com/mattermost/rsc/qr" ) const ( diff --git a/services/mfa/mfa_test.go b/services/mfa/mfa_test.go index 2b03cbc7dfc..25babc83568 100644 --- a/services/mfa/mfa_test.go +++ b/services/mfa/mfa_test.go @@ -11,13 +11,13 @@ import ( "time" "github.com/dgryski/dgoogauth" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/mattermost/mattermost-server/v5/utils/testutils" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestGenerateSecret(t *testing.T) { diff --git a/services/searchengine/bleveengine/bleve.go b/services/searchengine/bleveengine/bleve.go index 1d3bdf418be..8c4b70760f3 100644 --- a/services/searchengine/bleveengine/bleve.go +++ b/services/searchengine/bleveengine/bleve.go @@ -11,14 +11,14 @@ import ( "sync/atomic" "time" - "github.com/mattermost/mattermost-server/v5/jobs" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/blevesearch/bleve" "github.com/blevesearch/bleve/analysis/analyzer/keyword" "github.com/blevesearch/bleve/analysis/analyzer/standard" "github.com/blevesearch/bleve/mapping" + + "github.com/mattermost/mattermost-server/v5/jobs" + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" ) const ( diff --git a/services/searchengine/bleveengine/search.go b/services/searchengine/bleveengine/search.go index 55f5e88d97c..a6360a971ec 100644 --- a/services/searchengine/bleveengine/search.go +++ b/services/searchengine/bleveengine/search.go @@ -7,11 +7,11 @@ import ( "net/http" "strings" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/blevesearch/bleve" "github.com/blevesearch/bleve/search/query" + + "github.com/mattermost/mattermost-server/v5/mlog" + "github.com/mattermost/mattermost-server/v5/model" ) const DeletePostsBatchSize = 500 diff --git a/services/telemetry/telemetry.go b/services/telemetry/telemetry.go index 0c823cc7229..64a02e5d124 100644 --- a/services/telemetry/telemetry.go +++ b/services/telemetry/telemetry.go @@ -10,6 +10,8 @@ import ( "strings" "time" + rudder "github.com/rudderlabs/analytics-go" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin" @@ -18,8 +20,6 @@ import ( "github.com/mattermost/mattermost-server/v5/services/searchengine" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" - - rudder "github.com/rudderlabs/analytics-go" ) const ( diff --git a/services/tracing/tracing.go b/services/tracing/tracing.go index e52ed67e0e5..eac51db319a 100644 --- a/services/tracing/tracing.go +++ b/services/tracing/tracing.go @@ -4,18 +4,17 @@ package tracing import ( + "context" "io" "time" - "github.com/mattermost/mattermost-server/v5/mlog" opentracing "github.com/opentracing/opentracing-go" - "github.com/uber/jaeger-lib/metrics" - - "context" - "github.com/uber/jaeger-client-go" jaegercfg "github.com/uber/jaeger-client-go/config" "github.com/uber/jaeger-client-go/zipkin" + "github.com/uber/jaeger-lib/metrics" + + "github.com/mattermost/mattermost-server/v5/mlog" ) // Tracer is a wrapper around Jaeger OpenTracing client, used to properly de-initialize jaeger on exit diff --git a/services/upgrader/errors.go b/services/upgrader/errors.go index 52ef3892cff..74dd76ba337 100644 --- a/services/upgrader/errors.go +++ b/services/upgrader/errors.go @@ -3,7 +3,9 @@ package upgrader -import "fmt" +import ( + "fmt" +) // InvalidArch indicates that the current operating system or cpu architecture doesn't support upgrades type InvalidArch struct{} diff --git a/services/upgrader/upgrader_linux_test.go b/services/upgrader/upgrader_linux_test.go index 1498d5eab58..c962de2972f 100644 --- a/services/upgrader/upgrader_linux_test.go +++ b/services/upgrader/upgrader_linux_test.go @@ -10,8 +10,9 @@ import ( "os" "testing" - "github.com/mattermost/mattermost-server/v5/model" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" ) func TestCanIUpgradeToE0(t *testing.T) { diff --git a/store/localcachelayer/channel_layer_test.go b/store/localcachelayer/channel_layer_test.go index b3cc8a020fc..c4b131d2134 100644 --- a/store/localcachelayer/channel_layer_test.go +++ b/store/localcachelayer/channel_layer_test.go @@ -6,11 +6,10 @@ package localcachelayer import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" ) diff --git a/store/localcachelayer/emoji_layer_test.go b/store/localcachelayer/emoji_layer_test.go index a7a79b19d4d..d5bdb576d89 100644 --- a/store/localcachelayer/emoji_layer_test.go +++ b/store/localcachelayer/emoji_layer_test.go @@ -6,11 +6,12 @@ package localcachelayer import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestEmojiStore(t *testing.T) { diff --git a/store/localcachelayer/file_info_layer_test.go b/store/localcachelayer/file_info_layer_test.go index 6888fc10647..38f757d94ca 100644 --- a/store/localcachelayer/file_info_layer_test.go +++ b/store/localcachelayer/file_info_layer_test.go @@ -6,11 +6,12 @@ package localcachelayer import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestFileInfoStore(t *testing.T) { diff --git a/store/localcachelayer/main_test.go b/store/localcachelayer/main_test.go index 963003312bd..4090809c8f9 100644 --- a/store/localcachelayer/main_test.go +++ b/store/localcachelayer/main_test.go @@ -7,15 +7,15 @@ import ( "fmt" "testing" - "github.com/mattermost/mattermost-server/v5/mlog" - "github.com/mattermost/mattermost-server/v5/services/cache" + "github.com/stretchr/testify/mock" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/services/cache" cachemocks "github.com/mattermost/mattermost-server/v5/services/cache/mocks" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/mattermost/mattermost-server/v5/testlib" - "github.com/stretchr/testify/mock" ) var mainHelper *testlib.MainHelper diff --git a/store/localcachelayer/post_layer.go b/store/localcachelayer/post_layer.go index b0c4b167523..4293e73e69b 100644 --- a/store/localcachelayer/post_layer.go +++ b/store/localcachelayer/post_layer.go @@ -4,13 +4,12 @@ package localcachelayer import ( + "fmt" "strconv" "strings" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "fmt" ) type LocalCachePostStore struct { diff --git a/store/localcachelayer/post_layer_test.go b/store/localcachelayer/post_layer_test.go index 7952557d442..cf0a1e7c55d 100644 --- a/store/localcachelayer/post_layer_test.go +++ b/store/localcachelayer/post_layer_test.go @@ -7,11 +7,12 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPostStore(t *testing.T) { diff --git a/store/localcachelayer/reaction_layer_test.go b/store/localcachelayer/reaction_layer_test.go index a9d49efe552..ccabdfdfd72 100644 --- a/store/localcachelayer/reaction_layer_test.go +++ b/store/localcachelayer/reaction_layer_test.go @@ -6,11 +6,12 @@ package localcachelayer import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestReactionStore(t *testing.T) { diff --git a/store/localcachelayer/role_layer_test.go b/store/localcachelayer/role_layer_test.go index 7f89ba790eb..99bcd9fa4a9 100644 --- a/store/localcachelayer/role_layer_test.go +++ b/store/localcachelayer/role_layer_test.go @@ -6,11 +6,12 @@ package localcachelayer import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestRoleStore(t *testing.T) { diff --git a/store/localcachelayer/scheme_layer_test.go b/store/localcachelayer/scheme_layer_test.go index 0649cc98e7f..461a610f9e9 100644 --- a/store/localcachelayer/scheme_layer_test.go +++ b/store/localcachelayer/scheme_layer_test.go @@ -6,11 +6,12 @@ package localcachelayer import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestSchemeStore(t *testing.T) { diff --git a/store/localcachelayer/team_layer_test.go b/store/localcachelayer/team_layer_test.go index e0df7b272dc..7c24a84f58f 100644 --- a/store/localcachelayer/team_layer_test.go +++ b/store/localcachelayer/team_layer_test.go @@ -6,10 +6,11 @@ package localcachelayer import ( "testing" - "github.com/mattermost/mattermost-server/v5/store/storetest" - "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/store/storetest" + "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" ) func TestTeamStore(t *testing.T) { diff --git a/store/localcachelayer/terms_of_service_layer_test.go b/store/localcachelayer/terms_of_service_layer_test.go index 7c300f0b342..7574c6ca5a8 100644 --- a/store/localcachelayer/terms_of_service_layer_test.go +++ b/store/localcachelayer/terms_of_service_layer_test.go @@ -6,11 +6,12 @@ package localcachelayer import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestTermsOfServiceStore(t *testing.T) { diff --git a/store/retrylayer/retrylayer_test.go b/store/retrylayer/retrylayer_test.go index d48b7f67197..f62f2c1a288 100644 --- a/store/retrylayer/retrylayer_test.go +++ b/store/retrylayer/retrylayer_test.go @@ -8,9 +8,10 @@ import ( "github.com/go-sql-driver/mysql" "github.com/lib/pq" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/pkg/errors" ) func genStore() *mocks.Store { diff --git a/store/searchlayer/channel_layer.go b/store/searchlayer/channel_layer.go index 1ff405fc003..e8e71a7278c 100644 --- a/store/searchlayer/channel_layer.go +++ b/store/searchlayer/channel_layer.go @@ -4,11 +4,12 @@ package searchlayer import ( + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/searchengine" "github.com/mattermost/mattermost-server/v5/store" - "github.com/pkg/errors" ) type SearchChannelStore struct { diff --git a/store/searchlayer/post_layer.go b/store/searchlayer/post_layer.go index d30984f06f7..b077e11c6d8 100644 --- a/store/searchlayer/post_layer.go +++ b/store/searchlayer/post_layer.go @@ -4,11 +4,12 @@ package searchlayer import ( + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/searchengine" "github.com/mattermost/mattermost-server/v5/store" - "github.com/pkg/errors" ) type SearchPostStore struct { diff --git a/store/searchlayer/user_layer.go b/store/searchlayer/user_layer.go index 4afd90c02b0..6c2ac175291 100644 --- a/store/searchlayer/user_layer.go +++ b/store/searchlayer/user_layer.go @@ -6,11 +6,12 @@ package searchlayer import ( "strings" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/searchengine" "github.com/mattermost/mattermost-server/v5/store" - "github.com/pkg/errors" ) type SearchUserStore struct { diff --git a/store/searchlayer/utils.go b/store/searchlayer/utils.go index 176c4ed43ea..522fd6eb13c 100644 --- a/store/searchlayer/utils.go +++ b/store/searchlayer/utils.go @@ -3,7 +3,9 @@ package searchlayer -import "strings" +import ( + "strings" +) func sanitizeSearchTerm(term string) string { return strings.TrimLeft(term, "@") diff --git a/store/searchtest/channel_layer.go b/store/searchtest/channel_layer.go index cc436afab31..ccd94a02fe5 100644 --- a/store/searchtest/channel_layer.go +++ b/store/searchtest/channel_layer.go @@ -6,9 +6,10 @@ package searchtest import ( "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/require" ) var searchChannelStoreTests = []searchTest{ diff --git a/store/searchtest/helper.go b/store/searchtest/helper.go index 540f0121c08..b7b75c6d7f5 100644 --- a/store/searchtest/helper.go +++ b/store/searchtest/helper.go @@ -7,12 +7,12 @@ import ( "fmt" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/pkg/errors" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) type SearchTestHelper struct { diff --git a/store/searchtest/post_layer.go b/store/searchtest/post_layer.go index 190230b7130..f0c4df4a7b1 100644 --- a/store/searchtest/post_layer.go +++ b/store/searchtest/post_layer.go @@ -7,9 +7,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/require" ) var searchPostStoreTests = []searchTest{ diff --git a/store/searchtest/user_layer.go b/store/searchtest/user_layer.go index b4bc6abb979..8bfdde5df11 100644 --- a/store/searchtest/user_layer.go +++ b/store/searchtest/user_layer.go @@ -6,9 +6,10 @@ package searchtest import ( "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/require" ) var searchUserStoreTests = []searchTest{ diff --git a/store/sqlstore/bot_store.go b/store/sqlstore/bot_store.go index 6f285875061..460635470fe 100644 --- a/store/sqlstore/bot_store.go +++ b/store/sqlstore/bot_store.go @@ -8,11 +8,11 @@ import ( "fmt" "strings" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) // bot is a subset of the model.Bot type, omitting the model.User fields. diff --git a/store/sqlstore/channel_member_history_store.go b/store/sqlstore/channel_member_history_store.go index fa8d008aab3..44f7bf45d95 100644 --- a/store/sqlstore/channel_member_history_store.go +++ b/store/sqlstore/channel_member_history_store.go @@ -8,12 +8,11 @@ import ( "fmt" sq "github.com/Masterminds/squirrel" + "github.com/pkg/errors" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlChannelMemberHistoryStore struct { diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go index 35fb2c5036b..a8e338a220d 100644 --- a/store/sqlstore/channel_store.go +++ b/store/sqlstore/channel_store.go @@ -11,15 +11,15 @@ import ( "strings" "time" + sq "github.com/Masterminds/squirrel" "github.com/mattermost/gorp" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/cache" "github.com/mattermost/mattermost-server/v5/store" - - sq "github.com/Masterminds/squirrel" - "github.com/pkg/errors" ) const ( diff --git a/store/sqlstore/channel_store_categories.go b/store/sqlstore/channel_store_categories.go index 2f29d1b5a24..6b6c3ca4d33 100644 --- a/store/sqlstore/channel_store_categories.go +++ b/store/sqlstore/channel_store_categories.go @@ -6,12 +6,12 @@ package sqlstore import ( "fmt" + sq "github.com/Masterminds/squirrel" "github.com/mattermost/gorp" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - sq "github.com/Masterminds/squirrel" - "github.com/pkg/errors" ) func (s SqlChannelStore) CreateInitialSidebarCategories(userId, teamId string) error { diff --git a/store/sqlstore/command_store.go b/store/sqlstore/command_store.go index a34fe2760c3..b9202494723 100644 --- a/store/sqlstore/command_store.go +++ b/store/sqlstore/command_store.go @@ -6,11 +6,11 @@ package sqlstore import ( "database/sql" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" - sq "github.com/Masterminds/squirrel" "github.com/pkg/errors" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) type SqlCommandStore struct { diff --git a/store/sqlstore/command_webhook_store.go b/store/sqlstore/command_webhook_store.go index b79081e41c5..89c843fec91 100644 --- a/store/sqlstore/command_webhook_store.go +++ b/store/sqlstore/command_webhook_store.go @@ -7,12 +7,11 @@ import ( "database/sql" sq "github.com/Masterminds/squirrel" + "github.com/pkg/errors" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlCommandWebhookStore struct { diff --git a/store/sqlstore/compliance_store.go b/store/sqlstore/compliance_store.go index d915e3cbfda..6ff6c0c5dec 100644 --- a/store/sqlstore/compliance_store.go +++ b/store/sqlstore/compliance_store.go @@ -7,10 +7,10 @@ import ( "strconv" "strings" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlComplianceStore struct { diff --git a/store/sqlstore/context.go b/store/sqlstore/context.go index 3d74e09cc84..053985918e4 100644 --- a/store/sqlstore/context.go +++ b/store/sqlstore/context.go @@ -3,7 +3,9 @@ package sqlstore -import "context" +import ( + "context" +) // storeContextKey is the base type for all context keys for the store. type storeContextKey string diff --git a/store/sqlstore/emoji_store.go b/store/sqlstore/emoji_store.go index 1faea679479..910f29ae5e3 100644 --- a/store/sqlstore/emoji_store.go +++ b/store/sqlstore/emoji_store.go @@ -7,11 +7,11 @@ import ( "database/sql" "fmt" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlEmojiStore struct { diff --git a/store/sqlstore/integrity.go b/store/sqlstore/integrity.go index 651210cf04f..e2235b99b9b 100644 --- a/store/sqlstore/integrity.go +++ b/store/sqlstore/integrity.go @@ -4,10 +4,10 @@ package sqlstore import ( + sq "github.com/Masterminds/squirrel" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" - - sq "github.com/Masterminds/squirrel" ) type relationalCheckConfig struct { diff --git a/store/sqlstore/job_store.go b/store/sqlstore/job_store.go index 47ab3c670b7..9e30c1a7fb9 100644 --- a/store/sqlstore/job_store.go +++ b/store/sqlstore/job_store.go @@ -9,9 +9,9 @@ import ( "strings" sq "github.com/Masterminds/squirrel" + "github.com/mattermost/gorp" "github.com/pkg/errors" - "github.com/mattermost/gorp" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" ) diff --git a/store/sqlstore/license_store.go b/store/sqlstore/license_store.go index 8c948bfd76f..e056009064c 100644 --- a/store/sqlstore/license_store.go +++ b/store/sqlstore/license_store.go @@ -4,9 +4,8 @@ package sqlstore import ( - "github.com/pkg/errors" - sq "github.com/Masterminds/squirrel" + "github.com/pkg/errors" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" diff --git a/store/sqlstore/link_metadata_store.go b/store/sqlstore/link_metadata_store.go index 8fbfe4b34fc..8e1bd455b17 100644 --- a/store/sqlstore/link_metadata_store.go +++ b/store/sqlstore/link_metadata_store.go @@ -6,11 +6,11 @@ package sqlstore import ( "database/sql" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" - sq "github.com/Masterminds/squirrel" "github.com/pkg/errors" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) type SqlLinkMetadataStore struct { diff --git a/store/sqlstore/main_test.go b/store/sqlstore/main_test.go index c67cb021861..e7f8cca2c4a 100644 --- a/store/sqlstore/main_test.go +++ b/store/sqlstore/main_test.go @@ -8,7 +8,6 @@ import ( "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/store/sqlstore" - "github.com/mattermost/mattermost-server/v5/testlib" ) diff --git a/store/sqlstore/oauth_store.go b/store/sqlstore/oauth_store.go index bc02e4f6ccc..d2a231e9fa0 100644 --- a/store/sqlstore/oauth_store.go +++ b/store/sqlstore/oauth_store.go @@ -8,10 +8,10 @@ import ( "fmt" "github.com/mattermost/gorp" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlOAuthStore struct { diff --git a/store/sqlstore/post_store_test.go b/store/sqlstore/post_store_test.go index f2e4ee3e257..73dca3b96d6 100644 --- a/store/sqlstore/post_store_test.go +++ b/store/sqlstore/post_store_test.go @@ -4,9 +4,10 @@ package sqlstore import ( - "github.com/stretchr/testify/require" "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/store/searchtest" "github.com/mattermost/mattermost-server/v5/store/storetest" ) diff --git a/store/sqlstore/preference_store.go b/store/sqlstore/preference_store.go index 2487b4f8220..daec8adf8e6 100644 --- a/store/sqlstore/preference_store.go +++ b/store/sqlstore/preference_store.go @@ -6,9 +6,9 @@ package sqlstore import ( "fmt" + "github.com/mattermost/gorp" "github.com/pkg/errors" - "github.com/mattermost/gorp" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" diff --git a/store/sqlstore/preference_store_test.go b/store/sqlstore/preference_store_test.go index 2737f92dd02..90691c93298 100644 --- a/store/sqlstore/preference_store_test.go +++ b/store/sqlstore/preference_store_test.go @@ -6,11 +6,11 @@ package sqlstore import ( "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/store/storetest" - - "github.com/stretchr/testify/require" ) func TestPreferenceStore(t *testing.T) { diff --git a/store/sqlstore/product_notices_store.go b/store/sqlstore/product_notices_store.go index f9c76bbfb88..7594272f003 100644 --- a/store/sqlstore/product_notices_store.go +++ b/store/sqlstore/product_notices_store.go @@ -7,10 +7,10 @@ import ( "time" sq "github.com/Masterminds/squirrel" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlProductNoticesStore struct { diff --git a/store/sqlstore/reaction_store.go b/store/sqlstore/reaction_store.go index 532600c526f..2223226a8b6 100644 --- a/store/sqlstore/reaction_store.go +++ b/store/sqlstore/reaction_store.go @@ -4,12 +4,12 @@ package sqlstore import ( + "github.com/mattermost/gorp" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/mattermost/gorp" - "github.com/pkg/errors" ) type SqlReactionStore struct { diff --git a/store/sqlstore/role_store.go b/store/sqlstore/role_store.go index 4074f84b606..09473fe898d 100644 --- a/store/sqlstore/role_store.go +++ b/store/sqlstore/role_store.go @@ -9,9 +9,9 @@ import ( "strings" sq "github.com/Masterminds/squirrel" + "github.com/mattermost/gorp" "github.com/pkg/errors" - "github.com/mattermost/gorp" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" ) diff --git a/store/sqlstore/scheme_store.go b/store/sqlstore/scheme_store.go index e7e2d35a39a..9164dd71158 100644 --- a/store/sqlstore/scheme_store.go +++ b/store/sqlstore/scheme_store.go @@ -9,10 +9,10 @@ import ( "strings" "github.com/mattermost/gorp" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlSchemeStore struct { diff --git a/store/sqlstore/store.go b/store/sqlstore/store.go index 3668a4d609b..082e892cd21 100644 --- a/store/sqlstore/store.go +++ b/store/sqlstore/store.go @@ -15,21 +15,20 @@ import ( "sync/atomic" "time" - "github.com/pkg/errors" - sq "github.com/Masterminds/squirrel" "github.com/dyatlov/go-opengraph/opengraph" "github.com/go-sql-driver/mysql" + _ "github.com/go-sql-driver/mysql" "github.com/lib/pq" + _ "github.com/lib/pq" "github.com/mattermost/gorp" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" - - _ "github.com/go-sql-driver/mysql" - _ "github.com/lib/pq" ) const ( diff --git a/store/sqlstore/store_test.go b/store/sqlstore/store_test.go index 8a4bba07e3c..29ec5887783 100644 --- a/store/sqlstore/store_test.go +++ b/store/sqlstore/store_test.go @@ -13,15 +13,15 @@ import ( "github.com/go-sql-driver/mysql" "github.com/lib/pq" "github.com/mattermost/gorp" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" - "github.com/mattermost/mattermost-server/v5/store/searchtest" - "github.com/mattermost/mattermost-server/v5/store/storetest" + _ "github.com/mattn/go-sqlite3" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - _ "github.com/mattn/go-sqlite3" + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" + "github.com/mattermost/mattermost-server/v5/store/searchtest" + "github.com/mattermost/mattermost-server/v5/store/storetest" ) type storeType struct { diff --git a/store/sqlstore/system_store.go b/store/sqlstore/system_store.go index 9fb8147377b..f1fca00f9bf 100644 --- a/store/sqlstore/system_store.go +++ b/store/sqlstore/system_store.go @@ -10,11 +10,11 @@ import ( "strings" "time" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" - - "github.com/pkg/errors" ) type SqlSystemStore struct { diff --git a/store/sqlstore/team_store.go b/store/sqlstore/team_store.go index 3426b48e2af..22473222d12 100644 --- a/store/sqlstore/team_store.go +++ b/store/sqlstore/team_store.go @@ -10,9 +10,9 @@ import ( "strings" sq "github.com/Masterminds/squirrel" + "github.com/mattermost/gorp" "github.com/pkg/errors" - "github.com/mattermost/gorp" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" diff --git a/store/sqlstore/terms_of_service_store.go b/store/sqlstore/terms_of_service_store.go index 34788979502..32dd6f60264 100644 --- a/store/sqlstore/terms_of_service_store.go +++ b/store/sqlstore/terms_of_service_store.go @@ -6,11 +6,11 @@ package sqlstore import ( "database/sql" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlTermsOfServiceStore struct { diff --git a/store/sqlstore/thread_store.go b/store/sqlstore/thread_store.go index 0ba20b16e34..4b749bc13e7 100644 --- a/store/sqlstore/thread_store.go +++ b/store/sqlstore/thread_store.go @@ -7,12 +7,12 @@ import ( "database/sql" "time" + sq "github.com/Masterminds/squirrel" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/pkg/errors" - - sq "github.com/Masterminds/squirrel" ) type SqlThreadStore struct { diff --git a/store/sqlstore/tokens_store.go b/store/sqlstore/tokens_store.go index b9d3d1f4d98..00e81a18551 100644 --- a/store/sqlstore/tokens_store.go +++ b/store/sqlstore/tokens_store.go @@ -7,11 +7,11 @@ import ( "database/sql" "fmt" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlTokenStore struct { diff --git a/store/sqlstore/upgrade_test.go b/store/sqlstore/upgrade_test.go index 700e6a65e38..acd0cff8256 100644 --- a/store/sqlstore/upgrade_test.go +++ b/store/sqlstore/upgrade_test.go @@ -6,8 +6,9 @@ package sqlstore import ( "testing" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/store" ) func TestStoreUpgrade(t *testing.T) { diff --git a/store/sqlstore/upload_session_store.go b/store/sqlstore/upload_session_store.go index e8baed02eb0..12e2c0ebf1d 100644 --- a/store/sqlstore/upload_session_store.go +++ b/store/sqlstore/upload_session_store.go @@ -6,12 +6,11 @@ package sqlstore import ( "database/sql" + sq "github.com/Masterminds/squirrel" "github.com/pkg/errors" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - sq "github.com/Masterminds/squirrel" ) type SqlUploadSessionStore struct { diff --git a/store/sqlstore/user_access_token_store.go b/store/sqlstore/user_access_token_store.go index ab4e115c21b..a9bed6abeaa 100644 --- a/store/sqlstore/user_access_token_store.go +++ b/store/sqlstore/user_access_token_store.go @@ -7,9 +7,9 @@ import ( "database/sql" "fmt" + "github.com/mattermost/gorp" "github.com/pkg/errors" - "github.com/mattermost/gorp" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" ) diff --git a/store/sqlstore/user_store.go b/store/sqlstore/user_store.go index 0254e7981b4..861ceffdde9 100644 --- a/store/sqlstore/user_store.go +++ b/store/sqlstore/user_store.go @@ -10,13 +10,13 @@ import ( "sort" "strings" + sq "github.com/Masterminds/squirrel" "github.com/mattermost/gorp" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - sq "github.com/Masterminds/squirrel" - "github.com/pkg/errors" ) const ( diff --git a/store/sqlstore/user_terms_of_service.go b/store/sqlstore/user_terms_of_service.go index 463a377c98f..d39b7d97e2d 100644 --- a/store/sqlstore/user_terms_of_service.go +++ b/store/sqlstore/user_terms_of_service.go @@ -6,10 +6,10 @@ package sqlstore import ( "database/sql" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/pkg/errors" ) type SqlUserTermsOfServiceStore struct { diff --git a/store/sqlstore/utils.go b/store/sqlstore/utils.go index c4e3cd80fad..a02f61661d4 100644 --- a/store/sqlstore/utils.go +++ b/store/sqlstore/utils.go @@ -10,6 +10,7 @@ import ( "unicode" "github.com/mattermost/gorp" + "github.com/mattermost/mattermost-server/v5/mlog" ) diff --git a/store/sqlstore/webhook_store.go b/store/sqlstore/webhook_store.go index e30b68832b3..da611cd707f 100644 --- a/store/sqlstore/webhook_store.go +++ b/store/sqlstore/webhook_store.go @@ -6,9 +6,9 @@ package sqlstore import ( "database/sql" + sq "github.com/Masterminds/squirrel" "github.com/pkg/errors" - sq "github.com/Masterminds/squirrel" "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" diff --git a/store/storetest/audit_store.go b/store/storetest/audit_store.go index 3298e1cbb33..ea337aaa749 100644 --- a/store/storetest/audit_store.go +++ b/store/storetest/audit_store.go @@ -7,10 +7,11 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestAuditStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/channel_member_history_store.go b/store/storetest/channel_member_history_store.go index 476716c2725..a3b58af2fab 100644 --- a/store/storetest/channel_member_history_store.go +++ b/store/storetest/channel_member_history_store.go @@ -8,10 +8,11 @@ import ( "math" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestChannelMemberHistoryStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/channel_store.go b/store/storetest/channel_store.go index 0f4de2f7a3c..a2c468bdd50 100644 --- a/store/storetest/channel_store.go +++ b/store/storetest/channel_store.go @@ -11,10 +11,10 @@ import ( "testing" "time" + "github.com/mattermost/gorp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/mattermost/gorp" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/timezones" "github.com/mattermost/mattermost-server/v5/store" diff --git a/store/storetest/channel_store_categories.go b/store/storetest/channel_store_categories.go index 24951cc5f3e..0dbcc5e765e 100644 --- a/store/storetest/channel_store_categories.go +++ b/store/storetest/channel_store_categories.go @@ -9,10 +9,11 @@ import ( "sync" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestChannelStoreCategories(t *testing.T, ss store.Store, s SqlStore) { diff --git a/store/storetest/cluster_discovery_store.go b/store/storetest/cluster_discovery_store.go index faabacb8f6e..b4c093437a8 100644 --- a/store/storetest/cluster_discovery_store.go +++ b/store/storetest/cluster_discovery_store.go @@ -5,13 +5,13 @@ package storetest import ( "testing" - "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestClusterDiscoveryStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/command_webhook_store.go b/store/storetest/command_webhook_store.go index fc0fcdc2d51..8698efead9e 100644 --- a/store/storetest/command_webhook_store.go +++ b/store/storetest/command_webhook_store.go @@ -7,10 +7,11 @@ import ( "errors" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestCommandWebhookStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/compliance_store.go b/store/storetest/compliance_store.go index a29b7a75546..40554a8d251 100644 --- a/store/storetest/compliance_store.go +++ b/store/storetest/compliance_store.go @@ -8,10 +8,11 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func cleanupStoreState(t *testing.T, ss store.Store) { diff --git a/store/storetest/job_store.go b/store/storetest/job_store.go index 6a51c2b74cd..b4f3dcba511 100644 --- a/store/storetest/job_store.go +++ b/store/storetest/job_store.go @@ -9,10 +9,11 @@ import ( "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestJobStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/license_store.go b/store/storetest/license_store.go index 206058a9e1b..e82ec813de2 100644 --- a/store/storetest/license_store.go +++ b/store/storetest/license_store.go @@ -6,9 +6,10 @@ package storetest import ( "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/require" ) func TestLicenseStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/link_metadata_store.go b/store/storetest/link_metadata_store.go index fced33dc99c..98232c8c94d 100644 --- a/store/storetest/link_metadata_store.go +++ b/store/storetest/link_metadata_store.go @@ -9,10 +9,11 @@ import ( "time" "github.com/dyatlov/go-opengraph/opengraph" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) // These tests are ran on the same store instance, so this provides easier unique, valid timestamps diff --git a/store/storetest/mocks/ObjectCache.go b/store/storetest/mocks/ObjectCache.go index 33877564e2b..4eeb2fe4d08 100644 --- a/store/storetest/mocks/ObjectCache.go +++ b/store/storetest/mocks/ObjectCache.go @@ -4,7 +4,9 @@ package mocks -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" +) // ObjectCache is an autogenerated mock type for the ObjectCache type type ObjectCache struct { diff --git a/store/storetest/oauth_store.go b/store/storetest/oauth_store.go index 9dfd90ba8e1..2a4a3eb2754 100644 --- a/store/storetest/oauth_store.go +++ b/store/storetest/oauth_store.go @@ -6,10 +6,11 @@ package storetest import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestOAuthStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/plugin_store.go b/store/storetest/plugin_store.go index f6393bbb3e1..6ae11fc52dc 100644 --- a/store/storetest/plugin_store.go +++ b/store/storetest/plugin_store.go @@ -7,11 +7,11 @@ import ( "sort" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/assert" ) func TestPluginStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/store/storetest/post_store.go b/store/storetest/post_store.go index d5074b3b36c..affb48670bb 100644 --- a/store/storetest/post_store.go +++ b/store/storetest/post_store.go @@ -10,11 +10,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPostStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/store/storetest/product_notices_store.go b/store/storetest/product_notices_store.go index 1d7a797e03f..529adff995d 100644 --- a/store/storetest/product_notices_store.go +++ b/store/storetest/product_notices_store.go @@ -4,11 +4,12 @@ package storetest import ( - "github.com/mattermost/mattermost-server/v5/model" "testing" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestProductNoticesStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/reaction_store.go b/store/storetest/reaction_store.go index 45493fa99d3..5eadfc9fab3 100644 --- a/store/storetest/reaction_store.go +++ b/store/storetest/reaction_store.go @@ -8,12 +8,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/store/retrylayer" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestReactionStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/session_store.go b/store/storetest/session_store.go index 84aeef2374d..b7fd9cde172 100644 --- a/store/storetest/session_store.go +++ b/store/storetest/session_store.go @@ -6,11 +6,11 @@ package storetest import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) const ( diff --git a/store/storetest/settings.go b/store/storetest/settings.go index 8c26adecbcb..1d714d58423 100644 --- a/store/storetest/settings.go +++ b/store/storetest/settings.go @@ -4,14 +4,13 @@ package storetest import ( + "database/sql" "flag" "fmt" "net/url" "os" "path" - "database/sql" - "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql" _ "github.com/lib/pq" diff --git a/store/storetest/store.go b/store/storetest/store.go index 4af7b3fb654..78537a1e690 100644 --- a/store/storetest/store.go +++ b/store/storetest/store.go @@ -7,10 +7,11 @@ import ( "context" "time" + "github.com/stretchr/testify/mock" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/mock" ) // Store can be used to provide mock stores for testing. diff --git a/store/storetest/terms_of_service_store.go b/store/storetest/terms_of_service_store.go index 585a400d1da..eba076c202f 100644 --- a/store/storetest/terms_of_service_store.go +++ b/store/storetest/terms_of_service_store.go @@ -6,10 +6,11 @@ package storetest import ( "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestTermsOfServiceStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/thread_store.go b/store/storetest/thread_store.go index 5656ad820f6..daec4583f37 100644 --- a/store/storetest/thread_store.go +++ b/store/storetest/thread_store.go @@ -7,10 +7,11 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestThreadStore(t *testing.T, ss store.Store, s SqlStore) { diff --git a/store/storetest/upload_session_store.go b/store/storetest/upload_session_store.go index 0b9c4c0e3fb..6be39ac80fb 100644 --- a/store/storetest/upload_session_store.go +++ b/store/storetest/upload_session_store.go @@ -7,10 +7,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/stretchr/testify/require" ) func TestUploadSessionStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/user_access_token_store.go b/store/storetest/user_access_token_store.go index a63a57b51a0..b57e5c7b6cf 100644 --- a/store/storetest/user_access_token_store.go +++ b/store/storetest/user_access_token_store.go @@ -6,9 +6,10 @@ package storetest import ( "testing" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - "github.com/stretchr/testify/require" ) func TestUserAccessTokenStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/user_terms_of_service.go b/store/storetest/user_terms_of_service.go index 19470aa6d62..fe9d26edc86 100644 --- a/store/storetest/user_terms_of_service.go +++ b/store/storetest/user_terms_of_service.go @@ -7,10 +7,11 @@ import ( "errors" "testing" - "github.com/mattermost/mattermost-server/v5/model" - "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/model" + "github.com/mattermost/mattermost-server/v5/store" ) func TestUserTermsOfServiceStore(t *testing.T, ss store.Store) { diff --git a/store/storetest/webhook_store.go b/store/storetest/webhook_store.go index a5fe785643b..9c952034ca4 100644 --- a/store/storetest/webhook_store.go +++ b/store/storetest/webhook_store.go @@ -8,10 +8,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" - - "github.com/stretchr/testify/require" ) func TestWebhookStore(t *testing.T, ss store.Store) { diff --git a/testlib/helper.go b/testlib/helper.go index 210c958006d..d9d173da212 100644 --- a/testlib/helper.go +++ b/testlib/helper.go @@ -12,6 +12,8 @@ import ( "path/filepath" "testing" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/services/searchengine" @@ -20,7 +22,6 @@ import ( "github.com/mattermost/mattermost-server/v5/store/sqlstore" "github.com/mattermost/mattermost-server/v5/store/storetest" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/pkg/errors" ) type MainHelper struct { diff --git a/testlib/resources.go b/testlib/resources.go index 39645104a3c..e3db1ad977a 100644 --- a/testlib/resources.go +++ b/testlib/resources.go @@ -10,9 +10,9 @@ import ( "path" "path/filepath" - "github.com/mattermost/mattermost-server/v5/model" "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" "github.com/mattermost/mattermost-server/v5/utils/fileutils" ) diff --git a/utils/archive_test.go b/utils/archive_test.go index f19a477c8bc..77a0532d2d0 100644 --- a/utils/archive_test.go +++ b/utils/archive_test.go @@ -11,9 +11,9 @@ import ( "path/filepath" "testing" - "github.com/mattermost/mattermost-server/v5/utils/fileutils" - "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/utils/fileutils" ) func TestSanitizePath(t *testing.T) { diff --git a/utils/html.go b/utils/html.go index 7384e1304e8..d2aa0cdaa30 100644 --- a/utils/html.go +++ b/utils/html.go @@ -15,6 +15,7 @@ import ( "github.com/fsnotify/fsnotify" "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/utils/fileutils" ) diff --git a/utils/i18n.go b/utils/i18n.go index b55a2a94d7c..d8e7104f741 100644 --- a/utils/i18n.go +++ b/utils/i18n.go @@ -12,6 +12,7 @@ import ( "strings" "github.com/mattermost/go-i18n/i18n" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils/fileutils" diff --git a/utils/imgutils/gif_test.go b/utils/imgutils/gif_test.go index c5fb4e6a6c1..ef87a2b8e2e 100644 --- a/utils/imgutils/gif_test.go +++ b/utils/imgutils/gif_test.go @@ -7,9 +7,10 @@ import ( "bytes" "testing" - "github.com/mattermost/mattermost-server/v5/utils/testutils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/mattermost/mattermost-server/v5/utils/testutils" ) func TestCountFrames(t *testing.T) { diff --git a/utils/markdown/lines.go b/utils/markdown/lines.go index a67ec976589..f59e5afe394 100644 --- a/utils/markdown/lines.go +++ b/utils/markdown/lines.go @@ -3,7 +3,9 @@ package markdown -import "strings" +import ( + "strings" +) type Line struct { Range diff --git a/utils/utils.go b/utils/utils.go index 1c648229533..ef181d8b195 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -4,12 +4,13 @@ package utils import ( - "github.com/pkg/errors" "io/ioutil" "net" "net/http" "net/url" "strings" + + "github.com/pkg/errors" ) func StringInSlice(a string, slice []string) bool { diff --git a/web/context_test.go b/web/context_test.go index 3262f4dc0fe..1c7f864005f 100644 --- a/web/context_test.go +++ b/web/context_test.go @@ -7,11 +7,12 @@ import ( "net/http" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestRequireHookId(t *testing.T) { diff --git a/web/handlers.go b/web/handlers.go index 61363227918..ba62aa2fa03 100644 --- a/web/handlers.go +++ b/web/handlers.go @@ -15,6 +15,10 @@ import ( "time" "github.com/NYTimes/gziphandler" + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/ext" + spanlog "github.com/opentracing/opentracing-go/log" + "github.com/mattermost/mattermost-server/v5/app" app_opentracing "github.com/mattermost/mattermost-server/v5/app/opentracing" "github.com/mattermost/mattermost-server/v5/mlog" @@ -22,9 +26,6 @@ import ( "github.com/mattermost/mattermost-server/v5/services/tracing" "github.com/mattermost/mattermost-server/v5/store/opentracinglayer" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/ext" - spanlog "github.com/opentracing/opentracing-go/log" ) func GetHandlerName(h func(*Context, http.ResponseWriter, *http.Request)) string { diff --git a/web/handlers_test.go b/web/handlers_test.go index f4553674535..1584d26b974 100644 --- a/web/handlers_test.go +++ b/web/handlers_test.go @@ -8,12 +8,13 @@ import ( "net/http/httptest" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock" "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func handlerForHTTPErrors(c *Context, w http.ResponseWriter, r *http.Request) { diff --git a/web/oauth_test.go b/web/oauth_test.go index 6f0d2e16c86..7503c107be8 100644 --- a/web/oauth_test.go +++ b/web/oauth_test.go @@ -13,11 +13,12 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/einterfaces" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestOAuthComplete_AccessDenied(t *testing.T) { diff --git a/web/params.go b/web/params.go index 2b8adc21c84..ed2ffcfefd0 100644 --- a/web/params.go +++ b/web/params.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/gorilla/mux" + "github.com/mattermost/mattermost-server/v5/model" ) diff --git a/web/static.go b/web/static.go index f774d6891f1..5bf082035e7 100644 --- a/web/static.go +++ b/web/static.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/NYTimes/gziphandler" + "github.com/mattermost/mattermost-server/v5/mlog" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/utils" diff --git a/web/web_test.go b/web/web_test.go index a08c78ee89b..a63a1926ba3 100644 --- a/web/web_test.go +++ b/web/web_test.go @@ -13,6 +13,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/mattermost/mattermost-server/v5/app" "github.com/mattermost/mattermost-server/v5/config" "github.com/mattermost/mattermost-server/v5/mlog" @@ -23,8 +26,6 @@ import ( "github.com/mattermost/mattermost-server/v5/store/storetest/mocks" "github.com/mattermost/mattermost-server/v5/testlib" "github.com/mattermost/mattermost-server/v5/utils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ApiClient *model.Client4