diff --git a/.golangci.yml b/.golangci.yml index 29d9a4622a..06adcba6bc 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 926b619007..7517d814a6 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 de750130d8..d674ffd931 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 8f3efa339a..5b43f5ee0d 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 512f0c82af..2f5ae84c2d 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 1e2a2cba7a..5667e2ff60 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 d781e1fb28..3f44812809 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 a245a4aacb..5e1fa95d98 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 888386c0a1..a35b4aac15 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 17e236fe51..9167e4e60c 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 b7c67e5884..9ad6905ff1 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 944435cfbe..23945760dd 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 5faed407d5..1ab4802262 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 59802aae23..3b040b6777 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 6469496512..9bcfb17a6f 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 37703c6a98..26f46da357 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 f42ed676c0..aa6fa99666 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 746226f6f1..56e492ff90 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 4924f87eb9..e862bc6ce0 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 50e810939d..b2f809e96c 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 82d11912e5..55ba43bf14 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 4341267686..86e4f388a8 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 f15750fcf8..e247187ab6 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 2625cb4eab..b0c1131b64 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 70eb52d7e8..10f0b65453 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 fcd6c747d7..2515d4e08c 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 efabe2cb94..719a57bc15 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 939a10cfec..3a128d08ab 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 3bb8f38c84..8b27dcb94e 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 bd3ac4c1a3..4f290837c9 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 f43954cf6a..c81a8bd001 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 aac51eacbd..d638a73acd 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 40720249c3..3e1ee16238 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 c340a30143..2ac062613f 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 09861f7bdc..1a2f9bbc8d 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 e07282dd74..9291298cff 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 a3aa8eac81..ad9bd34c00 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 c153110d64..0b433d8c62 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 7b61103b25..33ed570af4 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 8ded6b781c..c810b3f6ae 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 437f6d8e91..54a654970d 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 ff1cb53419..e9ba0e72c6 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 daf0020465..431db31ecb 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 622ded3d79..a0b10660c9 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 9f1c180498..cdfc9b8a98 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 39cdb54cd5..7a7f7fa625 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 fcab7de697..ec6bf16c0f 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 06e89150dc..bcae659000 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 ee332aaa08..36c37a57bf 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 f38a90f0c4..4f50c1a469 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 52e5de9621..a300986df9 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 4366e908e6..7b46552a7b 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 764c7b9c57..d90d1c0694 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 222f04d463..73bb8aaa2c 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 f7ed301bf5..d3461a3257 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 62099076f8..8e55166d7f 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 8e3f97452a..b9cc09f39a 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 cefbb97dc1..d8783d8e4b 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 57d517263e..0a5fef534c 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 af3e671c66..8cd22acf92 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 90687d29a4..1fa7945372 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 7654ad80fe..d51aa66c1d 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 a6bce1bb38..a1eb00026d 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 38db548b02..71bb8a7149 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 76a35beae1..c6f001b8f9 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 1ddb97726e..2251c0745c 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 efe995cfd6..7c9c00e37d 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 c8ef59d8f1..f7debcc39e 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 9d3d107fdf..293e038f3f 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 50f544c6e8..f2c2d7579b 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 f0e42339d8..5a8a151fb9 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 51302bc26a..431ab2a998 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 d501166907..295a047b89 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 0332f3514c..ec4bb168f2 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 5c703fa25e..d6c49350be 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 94d59ec013..52da0ccb7a 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 5948e7cd59..e1cc4e7b40 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 c235b0a05e..24e1f4c392 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 23880d4980..7ad3b42716 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 cbf6069001..bf7a96adae 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 635c316f8a..e19871e043 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 fbf2de4cd2..0ac6e08eb9 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 8be5fa66a4..222792f7db 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 39b96d22ce..02bb0d0f02 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 74b7c57275..d25a7eeabd 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 47721f1101..7e0a64ed14 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 c3d1ef8062..8e75561c48 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 9340f63702..84aa97ca47 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 2c97cacf21..8f75ec220b 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 1cbf3a9f0f..e96c387457 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 1c65bce59a..d8af43be3b 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 c6984cf09c..3fa34c0071 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 8f11aff686..39c2151433 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 99dd983487..00126fc59d 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 eda886fd2f..7b72ec437a 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 ee3459a6dd..9cc97a369c 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 54b3c2fead..ded5d93cfe 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 794aaf73ca..f454a6fa1a 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 b174e39b19..6c3b4a7c13 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 de19d75f13..6449cd2acf 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 86664f2a11..8a343a33e2 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 461a013f1e..8d908e98e2 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 00406b19ea..66e9573c85 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 9dc6c0e5f2..b21e87e583 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 6697ade713..4794e9c795 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 9eb9d687f6..7a871db1a0 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 2229c38036..2c4c94e05b 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 2f697e8e42..fcdd5cb746 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 246f0bddf1..642f929554 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 e98c9ceab8..20b6635c66 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 7893ad1b49..1ac2af0bb0 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 a539f7f48a..9ef2125517 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 d1f4d2587d..c008b7d0cc 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 b10cddf304..5edf6b0104 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 07354a2d23..18c708af7b 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 91a451b271..14674ebf8f 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 a470e8d65d..8b13d4e661 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 36efa96057..dc07a34e22 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 074d72c97b..927c46e64a 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 71659e3acb..aaa79fdb05 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 8e3b3c3813..311cb55741 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 ed86da87af..def6f9948c 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 a48ba3bf58..0793f8ecb9 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 36b66f7310..697047292f 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 7ad55eec98..994d1efd29 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 59cee49344..fe00857450 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 d4799529f8..9bec52d614 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 fcba6bd4fb..fddfd6a653 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 807b415200..6116377f25 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 cdb549ebba..13ed467a19 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 74a55092d1..c24db42b7d 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 363e7c310e..c48d41a09c 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 b1a56cce82..06c7c6b8d9 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 d73c30d4ab..545b6346aa 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 61a606612d..90a4b31860 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 cac9715b67..f0d20ef50e 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 6feac6e3d3..d6f77dd0bc 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 5c03cd88e1..a0f673cd65 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 8db3d6d802..e8cdd5d63d 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 5a3685b213..d8cc1758b7 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 5aee98b0a9..07e4fb0652 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 4836729a7d..1670c53da0 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 abe9229f13..f1444d6bf7 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 ae877c0818..46c9b9351a 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 ba468aeef0..5c24f87a81 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 d48ab52561..5cf603b1ad 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 1bb56284e5..177684eded 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 d69416a1d7..3f80de269d 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 4c555d5989..5395e2ffe2 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 2e560f8a4a..0342299456 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 da16474c57..d0af4a6a10 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 7ce44f8653..4e388ee928 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 42d0f67df6..e8e9c21ce0 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 0f86fe9600..676ba677b7 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 a37f530632..2c7f1dee52 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 3f16ea713b..a468b85561 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 3915b3380a..e2c863be56 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 ac7a9f0472..799cfc5c8f 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 51d259c608..0d5b068705 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 d69ec602d3..edb21f8f3f 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 82dd2aa7a6..375a5c5d81 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 f3c56f9365..9244a824d1 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 9649a4842f..aaf1b89839 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 06d46e00d8..52f359626a 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 0729fde7de..dc853500d8 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 7c26a34f68..2d7a307771 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 a3cc7f4133..5deef2b67a 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 56e5a0fa57..5cb24fa57a 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 abdb9aab7e..1d5315ae1f 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 213d30c256..d93eb81e0a 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 dbfff3e464..d0a46eba35 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 3b62728011..c0fece06ae 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 8d5fe141b6..aa6bcaef10 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 52a2750063..6719b59ee5 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 d3f66bbf3a..44b116db00 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 0b1d1f0ba0..52844fbc6c 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 7f8de4906d..5e70bcfb12 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 eaf9253bef..6b586b8d47 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 753319f561..472aefaf1e 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 2f59c28683..d16412c758 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 7a70e2a0d5..1ebd77d671 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 63f6521f94..5c0f91ded9 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 dad1450b32..286072ba4a 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 854c2a61ac..d47305bb64 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 3184d1799a..879df39ea1 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 a2863f3598..2a2bcf5bc8 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 5b01249172..a260bc7ace 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 7a8a88c1fd..13d51d7e8b 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 f8d589688c..93762fda57 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 3616c8107f..491c6fb0ae 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 c00a8bbfc0..2368b085b7 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 dad20474fe..ffbd14f105 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 50af288034..24a8d94df0 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 429e1c3d52..5954432e0a 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 8acd559c3e..0a3bd1d1d6 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 909bf9112e..0c34731c63 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 9e1467c273..979f7dd91e 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 7495dace55..56c446b714 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 fb07d51a62..90f1569bfc 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 6aa88fc7ec..fae8ccb3ce 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 0730778cd0..2dcf4143e0 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 c3f16d56ac..4dbd002e83 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 7e08f051c2..289a98a129 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 caffd8becb..8a5f58dbe1 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 8c37507def..94e7aa41f1 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 b8bf2d767c..7d1f5cc599 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 f22edff4e5..c69be7f074 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 3b996dc52c..1494badb51 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 f2bba2e70b..e79cee2316 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 f19e4abb31..82335b0417 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 622aa3023f..850c9f9ab4 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 79357e37ec..263e2cf1e5 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 801ebe4cc7..ae6018a1f4 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 4b966a5770..1bb9e4705e 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 2dedbc873e..ae5a7846ee 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 db40510b12..e81a3c1b14 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 8aef7f0a61..2ee4141f95 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 ed4ebee72f..d0a18a4d69 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 c681fcc75d..20f7685bd8 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 612e48f653..21e278285e 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 36265ba0e5..75a0152f39 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 74cc58b693..4aab6e9bc3 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 2cfae041a4..2dbdcf3f84 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 f7617e7bea..7eab51ffc5 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 d16d8a258a..7515fc09cd 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 0fa2040d4a..406174e75b 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 898e4ad1bb..ddfc48e2d5 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 923040fb77..d3dd4befd0 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 e1e32bfb75..144bf8428b 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 1837777a7e..e7d57ded95 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 f9ff1e0421..ab0a55c5c0 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 b503a46c44..be7e237aa0 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 3e68484a40..a2bc6faccb 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 d8bd3ce277..2748f0be7a 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 2b03cbc7df..25babc8356 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 1d3bdf418b..8c4b70760f 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 55f5e88d97..a6360a971e 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 0c823cc722..64a02e5d12 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 e52ed67e0e..eac51db319 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 52ef3892cf..74dd76ba33 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 1498d5eab5..c962de2972 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 b3cc8a020f..c4b131d213 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 a7a79b19d4..d5bdb576d8 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 6888fc1064..38f757d94c 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 963003312b..4090809c8f 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 b0c4b16752..4293e73e69 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 7952557d44..cf0a1e7c55 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 a9d49efe55..ccabdfdfd7 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 7f89ba790e..99bcd9fa4a 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 0649cc98e7..461a610f9e 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 e0df7b272d..7c24a84f58 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 7c300f0b34..7574c6ca5a 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 d48b7f6719..f62f2c1a28 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 1ff405fc00..e8e71a7278 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 d30984f06f..b077e11c6d 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 4afd90c02b..6c2ac17529 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 176c4ed43e..522fd6eb13 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 cc436afab3..ccd94a02fe 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 540f0121c0..b7b75c6d7f 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 190230b713..f0c4df4a7b 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 b4bc6abb97..8bfdde5df1 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 6f28587506..460635470f 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 fa8d008aab..44f7bf45d9 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 35fb2c5036..a8e338a220 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 2f29d1b5a2..6b6c3ca4d3 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 a34fe2760c..b920249472 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 b79081e41c..89c843fec9 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 d915e3cbfd..6ff6c0c5de 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 3d74e09cc8..053985918e 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 1faea67947..910f29ae5e 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 651210cf04..e2235b99b9 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 47ab3c670b..9e30c1a7fb 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 8c948bfd76..e056009064 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 8fbfe4b34f..8e1bd455b1 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 c67cb02186..e7f8cca2c4 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 bc02e4f6cc..d2a231e9fa 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 f2e4ee3e25..73dca3b96d 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 2487b4f822..daec8adf8e 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 2737f92dd0..90691c9329 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 f9c76bbfb8..7594272f00 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 532600c526..2223226a8b 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 4074f84b60..09473fe898 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 e7e2d35a39..9164dd7115 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 3668a4d609..082e892cd2 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 8a4bba07e3..29ec588778 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 9fb8147377..f1fca00f9b 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 3426b48e2a..22473222d1 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 3478897950..32dd6f6026 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 0ba20b16e3..4b749bc13e 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 b9d3d1f4d9..00e81a1855 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 700e6a65e3..acd0cff825 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 e8baed02eb..12e2c0ebf1 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 ab4e115c21..a9bed6abea 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 0254e7981b..861ceffdde 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 463a377c98..d39b7d97e2 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 c4e3cd80fa..a02f61661d 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 e30b68832b..da611cd707 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 3298e1cbb3..ea337aaa74 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 476716c272..a3b58af2fa 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 0f4de2f7a3..a2c468bdd5 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 24951cc5f3..0dbcc5e765 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 faabacb8f6..b4c093437a 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 fc0fcdc2d5..8698efead9 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 a29b7a7554..40554a8d25 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 6a51c2b74c..b4f3dcba51 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 206058a9e1..e82ec813de 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 fced33dc99..98232c8c94 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 33877564e2..4eeb2fe4d0 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 9dfd90ba8e..2a4a3eb275 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 f6393bbb3e..6ae11fc52d 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 d5074b3b36..affb48670b 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 1d7a797e03..529adff995 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 45493fa99d..5eadfc9fab 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 84aeef2374..b7fd9cde17 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 8c26adecbc..1d714d5842 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 4af7b3fb65..78537a1e69 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 585a400d1d..eba076c202 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 5656ad820f..daec4583f3 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 0b9c4c0e3f..6be39ac80f 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 a63a57b51a..b57e5c7b6c 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 19470aa6d6..fe9d26edc8 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 a5fe785643..9c952034ca 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 210c958006..d9d173da21 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 39645104a3..e3db1ad977 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 f19a477c8b..77a0532d2d 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 7384e1304e..d2aa0cdaa3 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 b55a2a94d7..d8e7104f74 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 c5fb4e6a6c..ef87a2b8e2 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 a67ec97658..f59e5afe39 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 1c64822953..ef181d8b19 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 3262f4dc0f..1c7f864005 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 6136322791..ba62aa2fa0 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 f455367453..1584d26b97 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 6f0d2e16c8..7503c107be 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 2b8adc21c8..ed2ffcfefd 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 f774d6891f..5bf082035e 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 a08c78ee89..a63a1926ba 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