diff --git a/server/.golangci.yml b/server/.golangci.yml index 72910b0ff36..d8a78ac9afd 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -28,6 +28,7 @@ linters: - misspell - goimports - makezero + - whitespace # TODO: enable this later # - errcheck diff --git a/server/channels/api4/bot_test.go b/server/channels/api4/bot_test.go index 6c9eea4ed0d..e1ad248c560 100644 --- a/server/channels/api4/bot_test.go +++ b/server/channels/api4/bot_test.go @@ -1325,7 +1325,6 @@ func TestAssignBot(t *testing.T) { _, _, err = th.Client.AssignBot(context.Background(), bot.UserId, bot2.UserId) CheckErrorID(t, err, "api.context.permissions.app_error") - }) } diff --git a/server/channels/api4/channel_test.go b/server/channels/api4/channel_test.go index 3bb34555e58..92162b80014 100644 --- a/server/channels/api4/channel_test.go +++ b/server/channels/api4/channel_test.go @@ -834,7 +834,6 @@ func TestDeleteGroupChannel(t *testing.T) { _, err = client.DeleteChannel(context.Background(), rgc.Id) CheckErrorID(t, err, "api.channel.delete_channel.type.invalid") }) - } func TestGetChannel(t *testing.T) { @@ -2020,7 +2019,6 @@ func TestDeleteChannel(t *testing.T) { require.NoError(t, err) }) th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { - th.LoginBasic() publicChannel5 := th.CreatePublicChannel() c.Logout(context.Background()) @@ -2041,9 +2039,7 @@ func TestDeleteChannel(t *testing.T) { _, err = client.DeleteChannel(context.Background(), publicChannel5.Id) require.NoError(t, err) - }) - } func TestDeleteChannel2(t *testing.T) { @@ -3393,7 +3389,6 @@ func TestAddChannelMemberAddMyself(t *testing.T) { client.Login(context.Background(), user.Email, user.Password) for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { - // Check the appropriate permissions are enforced. defaultRolePermissions := th.SaveDefaultRolePermissions() defer func() { diff --git a/server/channels/api4/cloud_test.go b/server/channels/api4/cloud_test.go index da6d727c82d..90aabc3a38a 100644 --- a/server/channels/api4/cloud_test.go +++ b/server/channels/api4/cloud_test.go @@ -329,7 +329,6 @@ func Test_requestTrial(t *testing.T) { } func Test_validateBusinessEmail(t *testing.T) { - t.Run("Returns forbidden for invalid business email", func(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() diff --git a/server/channels/api4/command_test.go b/server/channels/api4/command_test.go index d263be60acb..bba6111499d 100644 --- a/server/channels/api4/command_test.go +++ b/server/channels/api4/command_test.go @@ -552,7 +552,6 @@ func TestGetCommand(t *testing.T) { newCmd, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd) require.NoError(t, err) th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { - t.Run("ValidId", func(t *testing.T) { cmd, _, err := client.GetCommandById(context.Background(), newCmd.Id) require.NoError(t, err) diff --git a/server/channels/api4/drafts.go b/server/channels/api4/drafts.go index 5500160899e..e26019ae1fc 100644 --- a/server/channels/api4/drafts.go +++ b/server/channels/api4/drafts.go @@ -21,7 +21,6 @@ func (api *API) InitDrafts() { } func upsertDraft(c *Context, w http.ResponseWriter, r *http.Request) { - if !*c.App.Config().ServiceSettings.AllowSyncedDrafts { c.Err = model.NewAppError("upsertDraft", "api.drafts.disabled.app_error", nil, "", http.StatusNotImplemented) return diff --git a/server/channels/api4/file.go b/server/channels/api4/file.go index 2df9a110fcd..541fdf030a1 100644 --- a/server/channels/api4/file.go +++ b/server/channels/api4/file.go @@ -42,7 +42,6 @@ func (api *API) InitFile() { api.BaseRoutes.Team.Handle("/files/search", api.APISessionRequiredDisableWhenBusy(searchFiles)).Methods("POST") api.BaseRoutes.PublicFile.Handle("", api.APIHandler(getPublicFile)).Methods("GET") - } func parseMultipartRequestHeader(req *http.Request) (boundary string, err error) { @@ -179,7 +178,6 @@ func uploadFileSimple(c *Context, r *http.Request, timestamp time.Time) *model.F // entire message recursively calling itself in stream mode. In case of (b) it // calls to uploadFileMultipartLegacy for legacy support func uploadFileMultipart(c *Context, r *http.Request, asStream io.Reader, timestamp time.Time) *model.FileUploadResponse { - expectClientIds := true var clientIds []string resp := model.FileUploadResponse{ @@ -356,7 +354,6 @@ NextPart: // *model.FileUploadResponse filled in with the individual model.FileInfo's. func uploadFileMultipartLegacy(c *Context, mr *multipart.Reader, timestamp time.Time) *model.FileUploadResponse { - // Parse the entire form. form, err := mr.ReadForm(*c.App.Config().FileSettings.MaxFileSize) if err != nil { diff --git a/server/channels/api4/file_test.go b/server/channels/api4/file_test.go index b7239f33dd3..c4474762470 100644 --- a/server/channels/api4/file_test.go +++ b/server/channels/api4/file_test.go @@ -97,7 +97,6 @@ func testUploadFilesPost( clientIds []string, useChunked bool, ) (*model.FileUploadResponse, *model.Response, error) { - // Do not check len(clientIds), leave it entirely to the user to // provide. The server will error out if it does not match the number // of files, but it's not critical here. @@ -731,7 +730,6 @@ func TestUploadFiles(t *testing.T) { th.cleanupTestFile(dbInfo) } }) - } } } diff --git a/server/channels/api4/group_test.go b/server/channels/api4/group_test.go index 49a31fa85be..2b2a9660173 100644 --- a/server/channels/api4/group_test.go +++ b/server/channels/api4/group_test.go @@ -1426,7 +1426,6 @@ func TestGetGroupsByUserId(t *testing.T) { groups, _, err = th.Client.GetGroupsByUserId(context.Background(), user1.Id) require.NoError(t, err) assert.ElementsMatch(t, []*model.Group{group1, group2}, groups) - } func TestGetGroupStats(t *testing.T) { diff --git a/server/channels/api4/handlers.go b/server/channels/api4/handlers.go index 2c54e730a21..62e20fd70e6 100644 --- a/server/channels/api4/handlers.go +++ b/server/channels/api4/handlers.go @@ -54,7 +54,6 @@ func (api *API) APISessionRequired(h handlerFunc) http.Handler { return gziphandler.GzipHandler(handler) } return handler - } // CloudAPIKeyRequired provides a handler for webhook endpoints to access Cloud installations from CWS @@ -74,7 +73,6 @@ func (api *API) CloudAPIKeyRequired(h handlerFunc) http.Handler { return gziphandler.GzipHandler(handler) } return handler - } // RemoteClusterTokenRequired provides a handler for remote cluster requests to /remotecluster endpoints. @@ -115,7 +113,6 @@ func (api *API) APISessionRequiredMfa(h handlerFunc) http.Handler { return gziphandler.GzipHandler(handler) } return handler - } // APIHandlerTrustRequester provides a handler for API endpoints which do not require the user to be logged in and are @@ -136,7 +133,6 @@ func (api *API) APIHandlerTrustRequester(h handlerFunc) http.Handler { return gziphandler.GzipHandler(handler) } return handler - } // APISessionRequiredTrustRequester provides a handler for API endpoints which do require the user to be logged in and @@ -156,7 +152,6 @@ func (api *API) APISessionRequiredTrustRequester(h handlerFunc) http.Handler { return gziphandler.GzipHandler(handler) } return handler - } // DisableWhenBusy provides a handler for API endpoints which should be disabled when the server is under load, @@ -177,7 +172,6 @@ func (api *API) APISessionRequiredDisableWhenBusy(h handlerFunc) http.Handler { return gziphandler.GzipHandler(handler) } return handler - } // APILocal provides a handler for API endpoints to be used in local diff --git a/server/channels/api4/ldap_local.go b/server/channels/api4/ldap_local.go index 0c1c30717a0..2ec96a7cb34 100644 --- a/server/channels/api4/ldap_local.go +++ b/server/channels/api4/ldap_local.go @@ -12,5 +12,4 @@ func (api *API) InitLdapLocal() { api.BaseRoutes.LDAP.Handle("/certificate/private", api.APILocal(addLdapPrivateCertificate)).Methods("POST") api.BaseRoutes.LDAP.Handle("/certificate/public", api.APILocal(removeLdapPublicCertificate)).Methods("DELETE") api.BaseRoutes.LDAP.Handle("/certificate/private", api.APILocal(removeLdapPrivateCertificate)).Methods("DELETE") - } diff --git a/server/channels/api4/license_test.go b/server/channels/api4/license_test.go index 7601932c996..df3ceb5493b 100644 --- a/server/channels/api4/license_test.go +++ b/server/channels/api4/license_test.go @@ -294,7 +294,6 @@ func TestRequestTrialLicenseWithExtraFields(t *testing.T) { }) t.Run("returns status 451 when it receives status 451", func(t *testing.T) { - license := model.NewTestLicense() license.Features.Users = model.NewInt(nUsers) licenseJSON, jsonErr := json.Marshal(license) @@ -369,7 +368,6 @@ func TestRequestTrialLicenseWithExtraFields(t *testing.T) { CheckErrorID(t, err, "api.license.upgrade_needed.app_error") CheckForbiddenStatus(t, resp) }) - } func TestRequestTrialLicense(t *testing.T) { diff --git a/server/channels/api4/notify_admin_test.go b/server/channels/api4/notify_admin_test.go index a9ceb6ed61e..46b1362562a 100644 --- a/server/channels/api4/notify_admin_test.go +++ b/server/channels/api4/notify_admin_test.go @@ -21,7 +21,6 @@ func TestNotifyAdmin(t *testing.T) { require.Error(t, err) require.Equal(t, http.StatusBadRequest, statusCode) - }) t.Run("error when plan is unknown when notifying on upgrade", func(t *testing.T) { @@ -36,7 +35,6 @@ func TestNotifyAdmin(t *testing.T) { require.Error(t, err) require.Equal(t, ": Unable to save notify data.", err.Error()) require.Equal(t, http.StatusInternalServerError, statusCode) - }) t.Run("error when plan is unknown when notifying to trial", func(t *testing.T) { @@ -52,7 +50,6 @@ func TestNotifyAdmin(t *testing.T) { require.Error(t, err) require.Equal(t, ": Unable to save notify data.", err.Error()) require.Equal(t, http.StatusInternalServerError, statusCode) - }) t.Run("error when feature is unknown when notifying on upgrade", func(t *testing.T) { @@ -132,7 +129,6 @@ func TestTriggerNotifyAdmin(t *testing.T) { require.Error(t, err) require.Equal(t, ": Internal error during cloud api request.", err.Error()) require.Equal(t, http.StatusForbidden, statusCode) - }) t.Run("error when non admins try to trigger notifications", func(t *testing.T) { diff --git a/server/channels/api4/plugin_test.go b/server/channels/api4/plugin_test.go index d61129afd38..dbb72e714f7 100644 --- a/server/channels/api4/plugin_test.go +++ b/server/channels/api4/plugin_test.go @@ -462,7 +462,6 @@ func TestDisableOnRemove(t *testing.T) { } func TestGetMarketplacePlugins(t *testing.T) { - th := Setup(t) defer th.TearDown() @@ -683,7 +682,6 @@ func TestGetMarketplacePlugins(t *testing.T) { } func TestGetInstalledMarketplacePlugins(t *testing.T) { - samplePlugins := []*model.MarketplacePlugin{ { BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ @@ -827,7 +825,6 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) { } func TestSearchGetMarketplacePlugins(t *testing.T) { - samplePlugins := []*model.MarketplacePlugin{ { BaseMarketplacePlugin: &model.BaseMarketplacePlugin{ @@ -953,7 +950,6 @@ func TestSearchGetMarketplacePlugins(t *testing.T) { } func TestGetLocalPluginInMarketplace(t *testing.T) { - th := Setup(t) defer th.TearDown() @@ -1115,7 +1111,6 @@ func TestGetLocalPluginInMarketplace(t *testing.T) { } func TestGetRemotePluginInMarketplace(t *testing.T) { - th := Setup(t) defer th.TearDown() @@ -1172,7 +1167,6 @@ func TestGetRemotePluginInMarketplace(t *testing.T) { } func TestGetPrepackagedPluginInMarketplace(t *testing.T) { - th := Setup(t) defer th.TearDown() @@ -1304,7 +1298,6 @@ func TestGetPrepackagedPluginInMarketplace(t *testing.T) { } func TestInstallMarketplacePlugin(t *testing.T) { - th := Setup(t).InitBasic() defer th.TearDown() @@ -1655,7 +1648,6 @@ func TestInstallMarketplacePlugin(t *testing.T) { } func TestInstallMarketplacePluginPrepackagedDisabled(t *testing.T) { - path, _ := fileutils.FindDir("tests") signatureFilename := "testplugin2.tar.gz.sig" diff --git a/server/channels/api4/post_test.go b/server/channels/api4/post_test.go index 11e1ff9b894..3c6287ab21a 100644 --- a/server/channels/api4/post_test.go +++ b/server/channels/api4/post_test.go @@ -1358,7 +1358,6 @@ func TestPatchPost(t *testing.T) { }) t.Run("err with integrations-reserved props", func(t *testing.T) { - originalHardenedModeSetting := *th.App.Config().ServiceSettings.ExperimentalEnableHardenedMode th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableHardenedMode = true diff --git a/server/channels/api4/preference_test.go b/server/channels/api4/preference_test.go index 5478da7707d..deba0c82504 100644 --- a/server/channels/api4/preference_test.go +++ b/server/channels/api4/preference_test.go @@ -192,7 +192,6 @@ func TestGetPreferenceByCategoryAndName(t *testing.T) { _, resp, err = client.GetPreferenceByCategoryAndName(context.Background(), user.Id, preferences[0].Category, preferences[0].Name) require.Error(t, err) CheckUnauthorizedStatus(t, resp) - } func TestUpdatePreferences(t *testing.T) { diff --git a/server/channels/api4/reaction_test.go b/server/channels/api4/reaction_test.go index e139fc544bb..03eb02d7487 100644 --- a/server/channels/api4/reaction_test.go +++ b/server/channels/api4/reaction_test.go @@ -574,7 +574,6 @@ func TestGetBulkReactions(t *testing.T) { assert.ElementsMatch(t, expectedPostIdsReactionsMap[post4.Id], postIdsReactionsMap[post4.Id]) assert.ElementsMatch(t, expectedPostIdsReactionsMap[post5.Id], postIdsReactionsMap[post5.Id]) assert.Equal(t, expectedPostIdsReactionsMap, postIdsReactionsMap) - }) t.Run("get-reactions-as-anonymous-user", func(t *testing.T) { diff --git a/server/channels/api4/resolver_channel_test.go b/server/channels/api4/resolver_channel_test.go index 57a04fd7caa..e36b670c162 100644 --- a/server/channels/api4/resolver_channel_test.go +++ b/server/channels/api4/resolver_channel_test.go @@ -273,7 +273,6 @@ func TestGraphQLChannels(t *testing.T) { assert.Equal(t, myTeam.DisplayName, ch.Team.DisplayName) } } - }) t.Run("Delete+Update", func(t *testing.T) { @@ -500,7 +499,6 @@ func TestGetPrettyDNForUsers(t *testing.T) { cache["user2"] = "teststring!!" assert.Equal(t, "teststring!!", getPrettyDNForUsers("full_name", users, "user1", cache)) }) - } func TestChannelCursor(t *testing.T) { diff --git a/server/channels/api4/role_test.go b/server/channels/api4/role_test.go index 10e3b94ece9..3747be988f3 100644 --- a/server/channels/api4/role_test.go +++ b/server/channels/api4/role_test.go @@ -184,7 +184,6 @@ func TestGetRolesByNames(t *testing.T) { _, _, err = client.GetRolesByNames(context.Background(), []string{model.NewId(), model.NewId(), "", " "}) require.NoError(t, err) }) - } func TestPatchRole(t *testing.T) { @@ -208,7 +207,6 @@ func TestPatchRole(t *testing.T) { } th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { - // Cannot edit a system admin adminRole, err := th.App.Srv().Store().Role().GetByName(context.Background(), "system_admin") assert.NoError(t, err) diff --git a/server/channels/api4/shared_channel_test.go b/server/channels/api4/shared_channel_test.go index eb1558f6e92..3ad1886d5ac 100644 --- a/server/channels/api4/shared_channel_test.go +++ b/server/channels/api4/shared_channel_test.go @@ -151,7 +151,6 @@ func TestGetRemoteClusterById(t *testing.T) { require.Error(t, err) CheckNotFoundStatus(t, resp) }) - } func TestCreateDirectChannelWithRemoteUser(t *testing.T) { diff --git a/server/channels/api4/system_test.go b/server/channels/api4/system_test.go index affcdd4e41f..e5651d8a490 100644 --- a/server/channels/api4/system_test.go +++ b/server/channels/api4/system_test.go @@ -438,7 +438,6 @@ func TestPostLog(t *testing.T) { logMessage, _, err := th.SystemAdminClient.PostLog(context.Background(), message) require.NoError(t, err) require.NotEmpty(t, logMessage, "should return the log message") - } func TestGetAnalyticsOld(t *testing.T) { @@ -966,7 +965,6 @@ func TestCompleteOnboarding(t *testing.T) { case <-time.After(15 * time.Second): require.Fail(t, "timed out waiting testplugin2 to be installed and enabled ") } - }) t.Run("as a system admin when plugins are disabled", func(t *testing.T) { diff --git a/server/channels/api4/team_test.go b/server/channels/api4/team_test.go index be7c6e2303e..2da75efa52d 100644 --- a/server/channels/api4/team_test.go +++ b/server/channels/api4/team_test.go @@ -1376,7 +1376,6 @@ func TestGetTeamByName(t *testing.T) { _, resp, err = client.GetTeamByName(context.Background(), "", "") require.Error(t, err) CheckNotFoundStatus(t, resp) - }) th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { @@ -2427,7 +2426,6 @@ func TestAddTeamMemberMyself(t *testing.T) { } }) } - } func TestAddTeamMembersDomainConstrained(t *testing.T) { @@ -2732,7 +2730,6 @@ func TestRemoveTeamMemberEvents(t *testing.T) { assert.Equal(t, eventUserId, th.BasicUser2.Id) }) }) - } func TestGetTeamStats(t *testing.T) { diff --git a/server/channels/api4/upload.go b/server/channels/api4/upload.go index d4f11ad1c65..1d07c34d44c 100644 --- a/server/channels/api4/upload.go +++ b/server/channels/api4/upload.go @@ -53,7 +53,6 @@ func createUpload(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = model.NewAppError("createUpload", "api.file.cloud_upload.app_error", nil, "", http.StatusBadRequest) return } - } else { if !c.App.SessionHasPermissionToChannel(c.AppContext, *c.AppContext.Session(), us.ChannelId, model.PermissionUploadFile) { c.SetPermissionError(model.PermissionUploadFile) diff --git a/server/channels/api4/user_test.go b/server/channels/api4/user_test.go index a9c05208247..a5917631c77 100644 --- a/server/channels/api4/user_test.go +++ b/server/channels/api4/user_test.go @@ -161,7 +161,6 @@ func TestCreateUserInputFilter(t *testing.T) { defer th.TearDown() t.Run("DomainRestriction", func(t *testing.T) { - enableAPIUserDeletion := th.App.Config().ServiceSettings.EnableAPIUserDeletion th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableOpenServer = true @@ -354,7 +353,6 @@ func TestCreateUserWithToken(t *testing.T) { }) t.Run("EnableUserCreationDisable", func(t *testing.T) { - enableUserCreation := th.App.Config().TeamSettings.EnableUserCreation defer func() { th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = enableUserCreation }) @@ -375,7 +373,6 @@ func TestCreateUserWithToken(t *testing.T) { require.Error(t, err) CheckNotImplementedStatus(t, resp) CheckErrorID(t, err, "api.user.create_user.signup_email_disabled.app_error") - }) th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { enableUserCreation := th.App.Config().TeamSettings.EnableUserCreation @@ -3053,7 +3050,6 @@ func TestGetUsersInGroup(t *testing.T) { require.NoError(t, err) assert.Equal(t, len(users), 0) }) - } func TestGetUsersInGroupByDisplayName(t *testing.T) { @@ -3111,7 +3107,6 @@ func TestGetUsersInGroupByDisplayName(t *testing.T) { require.NoError(t, err) assert.Equal(t, users[0].Id, user1.Id) }) - } func TestUpdateUserMfa(t *testing.T) { @@ -3586,7 +3581,6 @@ func TestRevokeSessionsFromAllUsers(t *testing.T) { sessions, err = th.Server.Store().Session().GetSessions(admin.Id) require.Empty(t, sessions) require.NoError(t, err) - } func TestAttachDeviceId(t *testing.T) { @@ -3607,7 +3601,6 @@ func TestAttachDeviceId(t *testing.T) { for _, tc := range testCases { t.Run(tc.Description, func(t *testing.T) { - th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SiteURL = tc.SiteURL }) @@ -6630,7 +6623,6 @@ func TestThreadSocketEvents(t *testing.T) { require.EqualValues(t, float64(1), data["previous_unread_mentions"]) require.EqualValues(t, float64(0), data["unread_replies"]) require.EqualValues(t, float64(0), data["unread_mentions"]) - } case <-time.After(1 * time.Second): return @@ -6660,7 +6652,6 @@ func TestThreadSocketEvents(t *testing.T) { require.EqualValues(t, float64(0), data["previous_unread_mentions"]) require.EqualValues(t, float64(1), data["unread_replies"]) require.EqualValues(t, float64(1), data["unread_mentions"]) - } case <-time.After(1 * time.Second): return @@ -6852,7 +6843,6 @@ func TestFollowThreads(t *testing.T) { require.NoError(t, err) require.Len(t, uss.Threads, 1) require.GreaterOrEqual(t, uss.Threads[0].LastViewedAt, uss.Threads[0].LastReplyAt) - }) t.Run("No permission to channel", func(t *testing.T) { @@ -6967,7 +6957,6 @@ func TestMaintainUnreadRepliesInThread(t *testing.T) { // should have 2 unread replies now checkThreadListReplies(t, th, th.SystemAdminClient, th.SystemAdminUser.Id, 2, 1, &model.GetUserThreadsOpts{Unread: true}) - } func TestThreadCounts(t *testing.T) { @@ -7167,7 +7156,6 @@ func TestReadThreads(t *testing.T) { }) client := th.Client t.Run("all threads", func(t *testing.T) { - rpost, resp, err := client.CreatePost(context.Background(), &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"}) require.NoError(t, err) CheckCreatedStatus(t, resp) diff --git a/server/channels/app/admin.go b/server/channels/app/admin.go index 95afdff8a6a..b6beeb81174 100644 --- a/server/channels/app/admin.go +++ b/server/channels/app/admin.go @@ -143,7 +143,6 @@ func (s *Server) InvalidateAllCaches() *model.AppError { func (s *Server) InvalidateAllCachesSkipSend() { s.platform.InvalidateAllCachesSkipSend() - } func (a *App) RecycleDatabaseConnection(c request.CTX) { diff --git a/server/channels/app/analytics.go b/server/channels/app/analytics.go index ec54a76448d..205bbeb7538 100644 --- a/server/channels/app/analytics.go +++ b/server/channels/app/analytics.go @@ -164,7 +164,6 @@ func (a *App) GetAnalytics(name string, teamID string) (model.AnalyticsRows, *mo rows[5].Value = float64(totalSockets) rows[6].Value = float64(totalMasterDb) rows[7].Value = float64(totalReadDb) - } else { rows[5].Value = float64(a.TotalWebsocketConnections()) rows[6].Value = float64(a.Srv().Store().TotalMasterDbConnections()) diff --git a/server/channels/app/authentication.go b/server/channels/app/authentication.go index ab63c987ba0..a57e55c2fbd 100644 --- a/server/channels/app/authentication.go +++ b/server/channels/app/authentication.go @@ -45,7 +45,6 @@ func (tl TokenLocation) String() string { } func (a *App) IsPasswordValid(password string) *model.AppError { - if err := users.IsPasswordValidWithSettings(password, &a.Config().PasswordSettings); err != nil { var invErr *users.ErrInvalidPassword switch { diff --git a/server/channels/app/authorization.go b/server/channels/app/authorization.go index 82f1674e21c..48543d2d2c8 100644 --- a/server/channels/app/authorization.go +++ b/server/channels/app/authorization.go @@ -212,7 +212,6 @@ func (a *App) SessionHasPermissionToGroup(session model.Session, groupID string, func (a *App) SessionHasPermissionToChannelByPost(session model.Session, postID string, permission *model.Permission) bool { if channelMember, err := a.Srv().Store().Channel().GetMemberForPost(postID, session.UserId); err == nil { - if a.RolesGrantPermission(channelMember.GetRoles(), permission.Id) { return true } diff --git a/server/channels/app/authorization_test.go b/server/channels/app/authorization_test.go index 19214728142..6eb58e25e45 100644 --- a/server/channels/app/authorization_test.go +++ b/server/channels/app/authorization_test.go @@ -45,7 +45,6 @@ func TestCheckIfRolesGrantPermission(t *testing.T) { for _, testcase := range cases { require.Equal(t, th.App.RolesGrantPermission(testcase.roles, testcase.permissionId), testcase.shouldGrant) } - } func TestChannelRolesGrantPermission(t *testing.T) { diff --git a/server/channels/app/auto_responder_test.go b/server/channels/app/auto_responder_test.go index 655e1dcc0f7..e6f0a2a85cf 100644 --- a/server/channels/app/auto_responder_test.go +++ b/server/channels/app/auto_responder_test.go @@ -49,7 +49,6 @@ func TestSetAutoResponderStatus(t *testing.T) { status, err = th.App.GetStatus(userUpdated2.Id) require.Nil(t, err) assert.Equal(t, model.StatusOnline, status.Status) - } func TestDisableAutoResponder(t *testing.T) { diff --git a/server/channels/app/channel.go b/server/channels/app/channel.go index 15b6a5033e9..381d92c4fb2 100644 --- a/server/channels/app/channel.go +++ b/server/channels/app/channel.go @@ -3205,7 +3205,6 @@ func (a *App) MoveChannel(c request.CTX, team *model.Team, channel *model.Channe } func (a *App) postChannelMoveMessage(c request.CTX, user *model.User, channel *model.Channel, previousTeam *model.Team) *model.AppError { - post := &model.Post{ ChannelId: channel.Id, Message: fmt.Sprintf(i18n.T("api.team.move_channel.success"), previousTeam.Name), diff --git a/server/channels/app/channel_test.go b/server/channels/app/channel_test.go index cc45e447249..1c9c61332a3 100644 --- a/server/channels/app/channel_test.go +++ b/server/channels/app/channel_test.go @@ -2341,7 +2341,6 @@ func TestMarkChannelAsUnreadFromPostCollapsedThreadsTurnedOff(t *testing.T) { } func TestMarkUnreadCRTOffUpdatesThreads(t *testing.T) { - th := Setup(t).InitBasic() defer th.TearDown() th.App.UpdateConfig(func(cfg *model.Config) { @@ -2662,5 +2661,4 @@ func TestConvertGroupMessageToChannel(t *testing.T) { convertedChannel, appErr := th.App.ConvertGroupMessageToChannel(th.Context, "user_id_1", conversionRequest) require.Nil(t, appErr) require.Equal(t, model.ChannelTypePrivate, convertedChannel.Type) - } diff --git a/server/channels/app/channels.go b/server/channels/app/channels.go index 1048b8614cb..ed8763ff6fa 100644 --- a/server/channels/app/channels.go +++ b/server/channels/app/channels.go @@ -287,7 +287,6 @@ func (ch *Channels) Start() error { ch.ShutDownPlugins() } } - }) // TODO: This should be moved to the platform service. diff --git a/server/channels/app/cluster_discovery.go b/server/channels/app/cluster_discovery.go index a706c4250e6..9af0cd11b28 100644 --- a/server/channels/app/cluster_discovery.go +++ b/server/channels/app/cluster_discovery.go @@ -12,6 +12,5 @@ func (a *App) IsLeader() bool { } func (a *App) GetClusterId() string { - return a.Srv().Platform().GetClusterId() } diff --git a/server/channels/app/cluster_handlers.go b/server/channels/app/cluster_handlers.go index d8db2b03026..6610b0495eb 100644 --- a/server/channels/app/cluster_handlers.go +++ b/server/channels/app/cluster_handlers.go @@ -66,7 +66,6 @@ func (s *Server) clusterPluginEventHandler(msg *model.ClusterMessage) { // The cluster event handlers are spread across this function and NewLocalCacheLayer. // Be careful to not have duplicated handlers here and there. func (s *Server) registerClusterHandlers() { - s.platform.RegisterClusterMessageHandler(model.ClusterEventInstallPlugin, s.clusterInstallPluginHandler) s.platform.RegisterClusterMessageHandler(model.ClusterEventRemovePlugin, s.clusterRemovePluginHandler) s.platform.RegisterClusterMessageHandler(model.ClusterEventPluginEvent, s.clusterPluginEventHandler) diff --git a/server/channels/app/command_autocomplete_test.go b/server/channels/app/command_autocomplete_test.go index 7c133ad1593..3270de4ac32 100644 --- a/server/channels/app/command_autocomplete_test.go +++ b/server/channels/app/command_autocomplete_test.go @@ -198,7 +198,6 @@ func TestParseNamedArguments(t *testing.T) { assert.False(t, found) assert.Equal(t, "bla", parsed) assert.Equal(t, "", toBeParsed) - } func TestSuggestions(t *testing.T) { diff --git a/server/channels/app/email/email_test.go b/server/channels/app/email/email_test.go index b06666074a3..e4329c0f230 100644 --- a/server/channels/app/email/email_test.go +++ b/server/channels/app/email/email_test.go @@ -163,7 +163,6 @@ func TestSendInviteEmails(t *testing.T) { false, ) require.Error(t, err) - }) t.Run("SendGuestInviteEmails should sanitize HTML input", func(t *testing.T) { @@ -356,7 +355,6 @@ func TestSendCloudWelcomeEmail(t *testing.T) { require.NoError(t, err, "Could not get message from mailbox") require.Contains(t, resultsEmail.Subject, "Congratulations!", "Wrong subject message %s", resultsEmail.Subject) require.Contains(t, resultsEmail.Body.Text, "Your workspace is ready to go!", "Wrong body %s", resultsEmail.Body.Text) - } mail.DeleteMailBox(emailTo) diff --git a/server/channels/app/export.go b/server/channels/app/export.go index 017ad6dd56f..3dbc3b0f469 100644 --- a/server/channels/app/export.go +++ b/server/channels/app/export.go @@ -540,7 +540,6 @@ func (a *App) BuildPostReactions(ctx request.CTX, postID string) (*[]ReactionImp } return &reactionsOfPost, nil - } func (a *App) buildPostAttachments(postID string) ([]imports.AttachmentImportData, *model.AppError) { diff --git a/server/channels/app/featureflag/feature_flags_sync.go b/server/channels/app/featureflag/feature_flags_sync.go index 9f37ebc53d3..8020acd6df9 100644 --- a/server/channels/app/featureflag/feature_flags_sync.go +++ b/server/channels/app/featureflag/feature_flags_sync.go @@ -95,7 +95,6 @@ func featureFlagsFromMap(featuresMap map[string]string, baseFeatureFlags model.F default: refField.Set(reflect.ValueOf(fieldValue)) } - } return baseFeatureFlags } diff --git a/server/channels/app/file.go b/server/channels/app/file.go index e654100f16b..bff245762a3 100644 --- a/server/channels/app/file.go +++ b/server/channels/app/file.go @@ -720,7 +720,6 @@ func (t *UploadFileTask) init(a *App) { // contained the last "good" FileInfo before the execution of that plugin. func (a *App) UploadFileX(c *request.Context, channelID, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError) { - t := &UploadFileTask{ ChannelId: filepath.Base(channelID), Name: filepath.Base(name), diff --git a/server/channels/app/file_bench_test.go b/server/channels/app/file_bench_test.go index 1566b26677e..672cc394379 100644 --- a/server/channels/app/file_bench_test.go +++ b/server/channels/app/file_bench_test.go @@ -89,7 +89,6 @@ func BenchmarkUploadFile(b *testing.B) { } th.App.Srv().Store().FileInfo().PermanentDelete(info1.Id) th.App.RemoveFile(info1.Path) - }, }, { diff --git a/server/channels/app/file_test.go b/server/channels/app/file_test.go index aa4a7024ddd..19f34befacc 100644 --- a/server/channels/app/file_test.go +++ b/server/channels/app/file_test.go @@ -647,7 +647,6 @@ func TestComputeLastAccessibleFileTime(t *testing.T) { mockSystemStore.AssertNotCalled(t, "SaveOrUpdate", mock.Anything) mockSystemStore.AssertCalled(t, "PermanentDeleteByName", mock.Anything) - }) } diff --git a/server/channels/app/import_functions.go b/server/channels/app/import_functions.go index c8619e9219b..9a0362b4fea 100644 --- a/server/channels/app/import_functions.go +++ b/server/channels/app/import_functions.go @@ -570,7 +570,6 @@ func (a *App) importUser(c request.CTX, data *imports.UserImportData, dryRun boo if err := a.Srv().Store().Preference().Save(model.Preferences{pref}); err != nil { c.Logger().Warn("Encountered error saving tutorial preference", mlog.Err(err)) } - } else { var appErr *model.AppError if hasUserChanged { diff --git a/server/channels/app/import_functions_test.go b/server/channels/app/import_functions_test.go index 285c15ca1d5..905bbe23c3f 100644 --- a/server/channels/app/import_functions_test.go +++ b/server/channels/app/import_functions_test.go @@ -215,7 +215,6 @@ func TestImportImportScheme(t *testing.T) { assert.Equal(t, *data.DisplayName, scheme.DisplayName) assert.Equal(t, *data.Description, scheme.Description) assert.Equal(t, "team", scheme.Scope) - } func TestImportImportSchemeWithoutGuestRoles(t *testing.T) { diff --git a/server/channels/app/imports/import_validators.go b/server/channels/app/imports/import_validators.go index c537cf40610..98b5ccd18a5 100644 --- a/server/channels/app/imports/import_validators.go +++ b/server/channels/app/imports/import_validators.go @@ -15,7 +15,6 @@ import ( ) func ValidateSchemeImportData(data *SchemeImportData) *model.AppError { - if data.Scope == nil { return model.NewAppError("BulkImport", "app.import.validate_scheme_import_data.null_scope.error", nil, "", http.StatusBadRequest) } @@ -85,7 +84,6 @@ func ValidateSchemeImportData(data *SchemeImportData) *model.AppError { } func ValidateRoleImportData(data *RoleImportData) *model.AppError { - if data.Name == nil || !model.IsValidRoleName(*data.Name) { return model.NewAppError("BulkImport", "app.import.validate_role_import_data.name_invalid.error", nil, "", http.StatusBadRequest) } @@ -118,7 +116,6 @@ func ValidateRoleImportData(data *RoleImportData) *model.AppError { } func ValidateTeamImportData(data *TeamImportData) *model.AppError { - if data.Name == nil { return model.NewAppError("BulkImport", "app.import.validate_team_import_data.name_missing.error", nil, "", http.StatusBadRequest) } else if len(*data.Name) > model.TeamNameMaxLength { @@ -153,7 +150,6 @@ func ValidateTeamImportData(data *TeamImportData) *model.AppError { } func ValidateChannelImportData(data *ChannelImportData) *model.AppError { - if data.Team == nil { return model.NewAppError("BulkImport", "app.import.validate_channel_import_data.team_missing.error", nil, "", http.StatusBadRequest) } diff --git a/server/channels/app/imports/import_validators_test.go b/server/channels/app/imports/import_validators_test.go index f37ec593bbc..b2de8ad0ea9 100644 --- a/server/channels/app/imports/import_validators_test.go +++ b/server/channels/app/imports/import_validators_test.go @@ -257,7 +257,6 @@ func TestImportValidateRoleImportData(t *testing.T) { } func TestImportValidateTeamImportData(t *testing.T) { - // Test with minimum required valid properties. data := TeamImportData{ Name: ptrStr("teamname"), @@ -355,7 +354,6 @@ func TestImportValidateTeamImportData(t *testing.T) { } func TestImportValidateChannelImportData(t *testing.T) { - // Test with minimum required valid properties. chanTypeOpen := model.ChannelTypeOpen data := ChannelImportData{ @@ -469,7 +467,6 @@ func TestImportValidateChannelImportData(t *testing.T) { } func TestImportValidateUserImportData(t *testing.T) { - // Test with minimum required valid properties. data := UserImportData{ Username: ptrStr("bob"), @@ -671,11 +668,9 @@ func TestImportValidateUserAuth(t *testing.T) { require.NotNil(t, err, fmt.Sprintf("authService: %v, authData: %v", test.authService, test.authData)) } } - } func TestImportValidateUserTeamsImportData(t *testing.T) { - // Invalid Name. data := []UserTeamImportData{ { @@ -721,7 +716,6 @@ func TestImportValidateUserTeamsImportData(t *testing.T) { } func TestImportValidateUserChannelsImportData(t *testing.T) { - // Invalid Name. data := []UserChannelImportData{ { @@ -1027,7 +1021,6 @@ func TestImportValidatePostImportData(t *testing.T) { } func TestImportValidateDirectChannelImportData(t *testing.T) { - // Test with valid number of members for direct message. data := DirectChannelImportData{ Members: &[]string{ diff --git a/server/channels/app/integration_action.go b/server/channels/app/integration_action.go index 625055a0471..fe4c59a2151 100644 --- a/server/channels/app/integration_action.go +++ b/server/channels/app/integration_action.go @@ -45,7 +45,6 @@ func (a *App) DoPostAction(c *request.Context, postID, actionId, userID, selecte } func (a *App) DoPostActionWithCookie(c *request.Context, postID, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError) { - // PostAction may result in the original post being updated. For the // updated post, we need to unconditionally preserve the original // IsPinned and HasReaction attributes, and preserve its entire diff --git a/server/channels/app/integration_action_test.go b/server/channels/app/integration_action_test.go index 1d06676f8b7..08330f01b0a 100644 --- a/server/channels/app/integration_action_test.go +++ b/server/channels/app/integration_action_test.go @@ -405,7 +405,6 @@ func TestPostAction(t *testing.T) { _, err = th.App.DoPostAction(th.Context, postSubpath.Id, attachmentsSubpath[0].Actions[0].Id, th.BasicUser.Id, "") require.Nil(t, err) - }) } } @@ -744,7 +743,6 @@ func TestPostActionRelativeURL(t *testing.T) { _, err = th.App.DoPostAction(th.Context, post.Id, attachments[0].Actions[0].Id, th.BasicUser.Id, "") require.NotNil(t, err) - }) t.Run("valid (but dirty) relative URL with SiteURL set", func(t *testing.T) { diff --git a/server/channels/app/layer_generators/main.go b/server/channels/app/layer_generators/main.go index 1a15ff4318a..9eec320c63e 100644 --- a/server/channels/app/layer_generators/main.go +++ b/server/channels/app/layer_generators/main.go @@ -113,7 +113,6 @@ func extractMethodMetadata(method *ast.Field, src []byte) methodData { paramsToTrace[strings.TrimSpace(p)] = true } } - } } if e.Params != nil { diff --git a/server/channels/app/ldap.go b/server/channels/app/ldap.go index de76fd79715..e6dd4172402 100644 --- a/server/channels/app/ldap.go +++ b/server/channels/app/ldap.go @@ -19,7 +19,6 @@ import ( // be re-added; otherwise, they will not be re-added. func (a *App) SyncLdap(c *request.Context, includeRemovedMembers bool) { a.Srv().Go(func() { - if license := a.Srv().License(); license != nil && *license.Features.LDAP { if !*a.Config().LdapSettings.EnableSync { c.Logger().Error("LdapSettings.EnableSync is set to false. Skipping LDAP sync.") diff --git a/server/channels/app/login.go b/server/channels/app/login.go index 868c221f7e0..0d962c8099f 100644 --- a/server/channels/app/login.go +++ b/server/channels/app/login.go @@ -257,7 +257,6 @@ func (a *App) AttachCloudSessionCookie(c *request.Context, w http.ResponseWriter if strings.Contains(domain, "localhost") { workspaceName = "localhost" } else { - // ensure we have a format for a cloud workspace url i.e. example.cloud.mattermost.com if len(strings.Split(domain, ".")) != 4 { return @@ -278,7 +277,6 @@ func (a *App) AttachCloudSessionCookie(c *request.Context, w http.ResponseWriter } http.SetCookie(w, cookie) - } func (a *App) AttachSessionCookies(c *request.Context, w http.ResponseWriter, r *http.Request) { diff --git a/server/channels/app/login_test.go b/server/channels/app/login_test.go index ae48e47acf9..989a51b72ec 100644 --- a/server/channels/app/login_test.go +++ b/server/channels/app/login_test.go @@ -40,7 +40,6 @@ func TestCheckForClientSideCert(t *testing.T) { } func TestCWSLogin(t *testing.T) { - th := Setup(t).InitBasic() defer th.TearDown() license := model.NewTestLicense() diff --git a/server/channels/app/migrations.go b/server/channels/app/migrations.go index 74860c84ef3..40605f85b99 100644 --- a/server/channels/app/migrations.go +++ b/server/channels/app/migrations.go @@ -467,7 +467,6 @@ func (s *Server) doPlaybooksRolesCreationMigration() { if err := s.Store().System().Save(&system); err != nil { mlog.Fatal("Failed to mark playbook roles creation migration as completed.", mlog.Err(err)) } - } // arbitrary choice, though if there is an longstanding installation with less than 10 messages, @@ -599,7 +598,6 @@ func (s *Server) doCloudS3PathMigrations(c *request.Context) { mlog.Fatal("failed to start job for migrating s3 file paths", mlog.Err(appErr)) return } - } func (a *App) DoAppMigrations() { diff --git a/server/channels/app/notification.go b/server/channels/app/notification.go index 976644a134d..ea9b9085dd5 100644 --- a/server/channels/app/notification.go +++ b/server/channels/app/notification.go @@ -1189,7 +1189,6 @@ func getMentionsEnabledFields(post *model.Post) model.StringArray { ret = append(ret, post.Message) for _, attachment := range post.Attachments() { - if attachment.Pretext != "" { ret = append(ret, attachment.Pretext) } diff --git a/server/channels/app/notification_push.go b/server/channels/app/notification_push.go index a928f743768..f4409e9e54a 100644 --- a/server/channels/app/notification_push.go +++ b/server/channels/app/notification_push.go @@ -187,7 +187,6 @@ func (a *App) sendPushNotification(notification *PostNotification, user *model.U func (a *App) getPushNotificationMessage(contentsConfig, postMessage string, explicitMention, channelWideMention, hasFiles bool, senderName string, channelType model.ChannelType, replyToThreadType string, userLocale i18n.TranslateFunc) string { - // If the post only has images then push an appropriate message if postMessage == "" && hasFiles { if channelType == model.ChannelTypeDirect { @@ -582,7 +581,6 @@ func DoesStatusAllowPushNotification(userNotifyProps model.StringMap, status *mo func (a *App) BuildPushNotificationMessage(c request.CTX, contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string, explicitMention bool, channelWideMention bool, replyToThreadType string) (*model.PushNotification, *model.AppError) { - var msg *model.PushNotification notificationInterface := a.ch.Notification @@ -669,7 +667,6 @@ func (a *App) buildIdLoadedPushNotificationMessage(c request.CTX, channel *model func (a *App) buildFullPushNotificationMessage(c request.CTX, contentsConfig string, post *model.Post, user *model.User, channel *model.Channel, channelName string, senderName string, explicitMention bool, channelWideMention bool, replyToThreadType string) *model.PushNotification { - msg := &model.PushNotification{ Category: model.CategoryCanReply, Version: model.PushMessageV2, diff --git a/server/channels/app/notification_test.go b/server/channels/app/notification_test.go index 983f4a4b004..aeb60bbd199 100644 --- a/server/channels/app/notification_test.go +++ b/server/channels/app/notification_test.go @@ -1376,7 +1376,6 @@ func TestGetMentionKeywords(t *testing.T) { require.True(t, ok) require.Equal(t, user4.Id, ids[0], "should've returned mention key of First") dup_count := func(list []string) map[string]int { - duplicate_frequency := make(map[string]int) for _, item := range list { @@ -1779,7 +1778,6 @@ func TestAddMentionKeywordsForUser(t *testing.T) { } func TestGetMentionsEnabledFields(t *testing.T) { - attachmentWithTextAndPreText := model.SlackAttachment{ Text: "@here with mentions", Pretext: "@Channel some comment for the channel", @@ -2244,7 +2242,6 @@ func TestCheckForMentionUsers(t *testing.T) { }, } { t.Run(name, func(t *testing.T) { - e := &ExplicitMentions{} e.checkForMention(tc.Word, tc.Keywords, nil) @@ -2550,7 +2547,6 @@ func TestUserAllowsEmail(t *testing.T) { assert.False(t, th.App.userAllowsEmail(th.Context, user, channelMemberNotifcationProps, &model.Post{Type: model.PostTypeAutoResponder})) }) - } func TestInsertGroupMentions(t *testing.T) { diff --git a/server/channels/app/oauth_test.go b/server/channels/app/oauth_test.go index b8345f707ca..16a526be585 100644 --- a/server/channels/app/oauth_test.go +++ b/server/channels/app/oauth_test.go @@ -469,7 +469,6 @@ func TestAuthorizeOAuthUser(t *testing.T) { _, _, _, _, err := th.App.AuthorizeOAuthUser(th.Context, nil, nil, model.ServiceOpenid, "", "", "") require.NotNil(t, err) assert.Equal(t, "api.user.get_authorization_code.endpoint.app_error", err.Id) - }) t.Run("enabled and properly configured", func(t *testing.T) { diff --git a/server/channels/app/permissions.go b/server/channels/app/permissions.go index 26d6a614861..b85ca03c575 100644 --- a/server/channels/app/permissions.go +++ b/server/channels/app/permissions.go @@ -103,14 +103,11 @@ func (a *App) ResetPermissionsSystem() *model.AppError { } func (a *App) ExportPermissions(w io.Writer) error { - next := a.SchemesIterator("", permissionsExportBatchSize) var schemeBatch []*model.Scheme for schemeBatch = next(); len(schemeBatch) > 0; schemeBatch = next() { - for _, scheme := range schemeBatch { - roleNames := []string{ scheme.DefaultTeamAdminRole, scheme.DefaultTeamUserRole, @@ -156,7 +153,6 @@ func (a *App) ExportPermissions(w io.Writer) error { return err } } - } defaultRoleNames := []string{} diff --git a/server/channels/app/permissions_test.go b/server/channels/app/permissions_test.go index 7fa68d6f3e4..bd94ba6563f 100644 --- a/server/channels/app/permissions_test.go +++ b/server/channels/app/permissions_test.go @@ -89,7 +89,6 @@ func TestExportPermissions(t *testing.T) { t.Errorf("Expected %v but got %v.", expected, actual) } } - } func TestImportPermissions(t *testing.T) { @@ -106,7 +105,6 @@ func TestImportPermissions(t *testing.T) { var results []*model.Scheme var beforeCount int withMigrationMarkedComplete(th, func() { - var appErr *model.AppError results, appErr = th.App.GetSchemes(scope, 0, 100) if appErr != nil { @@ -125,7 +123,6 @@ func TestImportPermissions(t *testing.T) { if appErr != nil { panic(appErr) } - }) actual := len(results) @@ -169,7 +166,6 @@ func TestImportPermissions(t *testing.T) { t.Errorf("Expected %v but got %v.", expected, actual) } } - } func TestImportPermissions_idempotentScheme(t *testing.T) { @@ -212,7 +208,6 @@ func TestImportPermissions_idempotentScheme(t *testing.T) { if expected != actual { t.Errorf("Expected count to be %v but got %v", expected, actual) } - } func TestImportPermissions_schemeDeletedOnRoleFailure(t *testing.T) { @@ -254,7 +249,6 @@ func TestImportPermissions_schemeDeletedOnRoleFailure(t *testing.T) { if expected != actual { t.Errorf("Expected count to be %v but got %v", expected, actual) } - } func TestMigration(t *testing.T) { diff --git a/server/channels/app/platform/cluster_handlers.go b/server/channels/app/platform/cluster_handlers.go index a45809085b6..3537f09ebda 100644 --- a/server/channels/app/platform/cluster_handlers.go +++ b/server/channels/app/platform/cluster_handlers.go @@ -161,7 +161,6 @@ func (ps *PlatformService) InvalidateAllCaches() *model.AppError { ps.InvalidateAllCachesSkipSend() if ps.clusterIFace != nil { - msg := &model.ClusterMessage{ Event: model.ClusterEventInvalidateAllCaches, SendType: model.ClusterSendReliable, diff --git a/server/channels/app/platform/config.go b/server/channels/app/platform/config.go index ae6042673e8..be3c85da5ac 100644 --- a/server/channels/app/platform/config.go +++ b/server/channels/app/platform/config.go @@ -368,7 +368,6 @@ func (ps *PlatformService) IsFirstUserAccount() bool { } return true - } func (ps *PlatformService) MaxPostSize() int { @@ -402,5 +401,4 @@ func (ps *PlatformService) GetSystemInstallDate() (int64, *model.AppError) { func (ps *PlatformService) ClientConfig() map[string]string { return ps.clientConfig.Load().(map[string]string) - } diff --git a/server/channels/app/platform/config_test.go b/server/channels/app/platform/config_test.go index ee26acc52d7..61c2c3aca85 100644 --- a/server/channels/app/platform/config_test.go +++ b/server/channels/app/platform/config_test.go @@ -189,5 +189,4 @@ func TestIsFirstUserAccountThunderingHerd(t *testing.T) { wg.Wait() }) } - } diff --git a/server/channels/app/platform/service.go b/server/channels/app/platform/service.go index 8869f5ea408..23e694d5957 100644 --- a/server/channels/app/platform/service.go +++ b/server/channels/app/platform/service.go @@ -371,7 +371,6 @@ func (ps *PlatformService) Start() error { ps.Go(func() { ps.Publish(message) }) - }) return nil } diff --git a/server/channels/app/platform/status.go b/server/channels/app/platform/status.go index 8ed29b9e49d..94c11e26f29 100644 --- a/server/channels/app/platform/status.go +++ b/server/channels/app/platform/status.go @@ -85,7 +85,6 @@ func (ps *PlatformService) GetStatusesByIds(userIDs []string) (map[string]any, * ps.AddStatusCacheSkipClusterSend(s) statusMap[s.UserId] = s.Status } - } // For the case where the user does not have a row in the Status table and cache @@ -134,7 +133,6 @@ func (ps *PlatformService) GetUserStatusesByIds(userIDs []string) ([]*model.Stat } statusMap = append(statusMap, statuses...) - } // For the case where the user does not have a row in the Status table and cache diff --git a/server/channels/app/plugin_api_test.go b/server/channels/app/plugin_api_test.go index c1dc4ae35f1..54b8ab6437e 100644 --- a/server/channels/app/plugin_api_test.go +++ b/server/channels/app/plugin_api_test.go @@ -127,7 +127,6 @@ func setupMultiPluginAPITest(t *testing.T, pluginCodes []string, pluginManifests } func setupPluginAPITest(t *testing.T, pluginCode string, pluginManifest string, pluginID string, app *App, c *request.Context) string { - asMain := pluginID != "test_db_driver" return setupMultiPluginAPITest(t, []string{pluginCode}, []string{pluginManifest}, []string{pluginID}, diff --git a/server/channels/app/plugin_api_tests/basic_config.go b/server/channels/app/plugin_api_tests/basic_config.go index 4cda1d9bb95..705e74e2612 100644 --- a/server/channels/app/plugin_api_tests/basic_config.go +++ b/server/channels/app/plugin_api_tests/basic_config.go @@ -20,7 +20,6 @@ type BasicConfig struct { } func IsEmpty(object any) bool { - // get nil case out of the way if object == nil { return true diff --git a/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go b/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go index c385d1c26cb..97df2aa602f 100644 --- a/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_get_channels_for_team_for_user_plugin/main.go @@ -22,7 +22,6 @@ func (p *MyPlugin) OnConfigurationChange() error { } func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) { - channels, err := p.API.GetChannelsForTeamForUser(p.configuration.BasicTeamID, p.configuration.BasicUserID, false) if err != nil { return nil, err.Error() diff --git a/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go b/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go index 21dcb072ae6..842dba83c1b 100644 --- a/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_get_profile_image_plugin/main.go @@ -22,7 +22,6 @@ func (p *MyPlugin) OnConfigurationChange() error { } func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) { - // check existing user first data, err := p.API.GetProfileImage(p.configuration.BasicUserID) if err != nil { diff --git a/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go b/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go index 1ab4891181a..4ac7c7113f1 100644 --- a/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_search_channels_plugin/main.go @@ -22,7 +22,6 @@ func (p *MyPlugin) OnConfigurationChange() error { } func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) { - channels, err := p.API.SearchChannels(p.configuration.BasicTeamID, p.configuration.BasicChannelName) if err != nil { return nil, err.Error() diff --git a/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go b/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go index 948db6c8179..8de94e7e60f 100644 --- a/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_set_profile_image_plugin/main.go @@ -28,7 +28,6 @@ func (p *MyPlugin) OnConfigurationChange() error { } func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) { - // Create an 128 x 128 image img := image.NewRGBA(image.Rect(0, 0, 128, 128)) // Draw a red dot at (2, 3) diff --git a/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go b/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go index be9f141438b..5fbf83a3ba1 100644 --- a/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go +++ b/server/channels/app/plugin_api_tests/test_update_user_status_plugin/main.go @@ -39,7 +39,6 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model if s != status.Status { return nil, fmt.Sprintf("Invalid status returned: %v != %v", s, status.Status) } - } status, err := p.API.UpdateUserStatus(uid, "notrealstatus") diff --git a/server/channels/app/plugin_commands_test.go b/server/channels/app/plugin_commands_test.go index c86a3433a9d..ab330ebd386 100644 --- a/server/channels/app/plugin_commands_test.go +++ b/server/channels/app/plugin_commands_test.go @@ -440,7 +440,6 @@ func TestPluginCommand(t *testing.T) { require.NotNil(t, err) require.Equal(t, 500, err.StatusCode) }) - } // Test Product with the minimum code needed to handle @@ -621,6 +620,5 @@ func TestProductCommands(t *testing.T) { require.Nil(t, err2) require.NotNil(t, resp) assert.Equal(t, "plugin slash command called", resp.Text) - }) } diff --git a/server/channels/app/plugin_test.go b/server/channels/app/plugin_test.go index 56d0c07a14a..adb7afba769 100644 --- a/server/channels/app/plugin_test.go +++ b/server/channels/app/plugin_test.go @@ -393,7 +393,6 @@ func TestPrivateServePluginRequest(t *testing.T) { th.App.ch.servePluginRequest(recorder, request, handler) }) } - } func TestHandlePluginRequest(t *testing.T) { @@ -505,7 +504,6 @@ func TestPluginSync(t *testing.T) { cfg.FileSettings.AmazonS3Endpoint = model.NewString(s3Endpoint) cfg.FileSettings.AmazonS3Region = model.NewString("") cfg.FileSettings.AmazonS3SSL = model.NewBool(false) - }, }, } diff --git a/server/channels/app/post.go b/server/channels/app/post.go index 1d6cb7c65b0..58d8fc3f308 100644 --- a/server/channels/app/post.go +++ b/server/channels/app/post.go @@ -1635,7 +1635,6 @@ func (a *App) SearchPostsForUser(c *request.Context, terms string, userID string } func (a *App) GetFileInfosForPostWithMigration(postID string, includeDeleted bool) ([]*model.FileInfo, *model.AppError) { - pchan := make(chan store.StoreResult, 1) go func() { post, err := a.Srv().Store().Post().GetSingle(postID, includeDeleted) @@ -2181,7 +2180,6 @@ func (a *App) CheckPostReminders() { } } } - } func (a *App) GetPostInfo(c request.CTX, postID string) (*model.PostInfo, *model.AppError) { diff --git a/server/channels/app/post_metadata.go b/server/channels/app/post_metadata.go index d49c33e010f..81d018fe89b 100644 --- a/server/channels/app/post_metadata.go +++ b/server/channels/app/post_metadata.go @@ -646,7 +646,6 @@ func (a *App) getLinkMetadata(c request.CTX, requestURL string, timestamp int64, permalink = &model.Permalink{PreviewPost: model.NewPreviewPost(referencedPostWithMetadata, referencedTeam, referencedChannel)} } } else { - var request *http.Request // Make request for a web page or an image request, err = http.NewRequest("GET", requestURL, nil) diff --git a/server/channels/app/post_metadata_test.go b/server/channels/app/post_metadata_test.go index 9fee9cd479b..69c1f3707e1 100644 --- a/server/channels/app/post_metadata_test.go +++ b/server/channels/app/post_metadata_test.go @@ -350,7 +350,6 @@ func TestPreparePostForClient(t *testing.T) { assert.True(t, ok) assert.EqualValues(t, colonEmoji, s) }) - }) t.Run("markdown image dimensions", func(t *testing.T) { @@ -1971,7 +1970,6 @@ func TestGetLinkMetadata(t *testing.T) { params := r.URL.Query() writeImage := func(height, width int) { - img := image.NewGray(image.Rect(0, 0, height, width)) var encoder png.Encoder diff --git a/server/channels/app/post_test.go b/server/channels/app/post_test.go index d7b46928b3d..3e0584e3567 100644 --- a/server/channels/app/post_test.go +++ b/server/channels/app/post_test.go @@ -1312,7 +1312,6 @@ func TestUpdatePost(t *testing.T) { }) t.Run("sanitizes post metadata appropriately", func(t *testing.T) { - th := Setup(t).InitBasic() defer th.TearDown() diff --git a/server/channels/app/product_notices.go b/server/channels/app/product_notices.go index 95d467300e1..6c87434933c 100644 --- a/server/channels/app/product_notices.go +++ b/server/channels/app/product_notices.go @@ -123,7 +123,6 @@ func noticeMatchesConditions(config *model.Config, preferences store.PreferenceS if !cnd.Audience.Matches(isSystemAdmin, isTeamAdmin) { return false, nil } - } // check user count condition against previously calculated total user count diff --git a/server/channels/app/response_transfer.go b/server/channels/app/response_transfer.go index e3acf3b5274..af9f9773969 100644 --- a/server/channels/app/response_transfer.go +++ b/server/channels/app/response_transfer.go @@ -40,7 +40,6 @@ func parseContentLength(cl string) int64 { return -1 } return n - } func (rt *PluginResponseWriter) GenerateResponse() *http.Response { diff --git a/server/channels/app/server.go b/server/channels/app/server.go index a93b79bbcc0..3aebc7b7f5d 100644 --- a/server/channels/app/server.go +++ b/server/channels/app/server.go @@ -1035,7 +1035,6 @@ func (s *Server) Start() error { go func() { var err error if *s.platform.Config().ServiceSettings.ConnectionSecurity == model.ConnSecurityTLS { - tlsConfig := &tls.Config{ PreferServerCipherSuites: true, CurvePreferences: []tls.CurveID{tls.CurveP521, tls.CurveP384, tls.CurveP256}, @@ -1467,7 +1466,6 @@ func (s *Server) doLicenseExpirationCheck() { // SendRemoveExpiredLicenseEmail formats an email and uses the email service to send the email to user with link pointing to CWS // to renew the user license func (s *Server) SendRemoveExpiredLicenseEmail(email, ctaText, ctaLink, locale, siteURL string) *model.AppError { - if err := s.EmailService.SendRemoveExpiredLicenseEmail(ctaText, ctaLink, email, locale, siteURL); err != nil { return model.NewAppError("SendRemoveExpiredLicenseEmail", "api.license.remove_expired_license.failed.error", nil, "", http.StatusInternalServerError).Wrap(err) } diff --git a/server/channels/app/session.go b/server/channels/app/session.go index e24c119931a..6c57d1b7e74 100644 --- a/server/channels/app/session.go +++ b/server/channels/app/session.go @@ -101,7 +101,6 @@ func (a *App) GetSession(token string) (*model.Session, *model.AppError) { !session.IsOAuth && !session.IsMobileApp() && session.Props[model.SessionPropType] != model.SessionTypeUserAccessToken && !*a.Config().ServiceSettings.ExtendSessionLengthWithActivity { - timeout := int64(*a.Config().ServiceSettings.SessionIdleTimeoutInMinutes) * 1000 * 60 if (model.GetMillis() - session.LastActivityAt) > timeout { // Revoking the session is an asynchronous task anyways since we are not checking @@ -210,7 +209,6 @@ func (a *App) RevokeSessionById(sessionID string) *model.AppError { return model.NewAppError("RevokeSessionById", "app.session.get.app_error", nil, "", http.StatusBadRequest).Wrap(err) } return a.RevokeSession(session) - } func (a *App) RevokeSession(session *model.Session) *model.AppError { @@ -346,7 +344,6 @@ func (a *App) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAc } return token, nil - } func (a *App) createSessionForUserAccessToken(tokenString string) (*model.Session, *model.AppError) { @@ -411,7 +408,6 @@ func (a *App) createSessionForUserAccessToken(tokenString string) (*model.Sessio a.ch.srv.platform.AddSessionToCache(session) return session, nil - } func (a *App) RevokeUserAccessToken(token *model.UserAccessToken) *model.AppError { @@ -483,7 +479,6 @@ func (a *App) GetUserAccessTokensForUser(userID string, page, perPage int) ([]*m } return tokens, nil - } func (a *App) GetUserAccessToken(tokenID string, sanitize bool) (*model.UserAccessToken, *model.AppError) { diff --git a/server/channels/app/slashcommands/command_loadtest.go b/server/channels/app/slashcommands/command_loadtest.go index 632bacf7dd2..33f75daf596 100644 --- a/server/channels/app/slashcommands/command_loadtest.go +++ b/server/channels/app/slashcommands/command_loadtest.go @@ -325,7 +325,6 @@ func (*LoadTestProvider) UsersCommand(a *app.App, c request.CTX, args *model.Com if err != nil { return &model.CommandResponse{Text: "Failed to add users: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err } - } team, err := a.Srv().Store().Team().Get(args.TeamId) @@ -369,7 +368,6 @@ func (*LoadTestProvider) ChannelsCommand(a *app.App, c request.CTX, args *model. if err != nil { return &model.CommandResponse{Text: "Failed to add channels: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err } - } team, err := a.Srv().Store().Team().Get(args.TeamId) @@ -427,7 +425,6 @@ func (*LoadTestProvider) DMsCommand(a *app.App, c request.CTX, args *model.Comma if err != nil { return &model.CommandResponse{Text: "Failed to add DMs: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err } - } time := int64(0) @@ -465,7 +462,6 @@ func (*LoadTestProvider) ThreadedPostCommand(a *app.App, c request.CTX, args *mo if err != nil { return &model.CommandResponse{Text: "Failed to create post: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err } - } time := int64(0) @@ -520,7 +516,6 @@ func (*LoadTestProvider) PostsCommand(a *app.App, c request.CTX, args *model.Com if err != nil { return &model.CommandResponse{Text: "Failed to add posts: " + err.Error(), ResponseType: model.CommandResponseTypeEphemeral}, err } - } maxImages := 0 @@ -565,7 +560,6 @@ func (*LoadTestProvider) PostsCommand(a *app.App, c request.CTX, args *model.Com if err != nil { return &model.CommandResponse{Text: "Failed to add posts", ResponseType: model.CommandResponseTypeEphemeral}, err } - } return &model.CommandResponse{Text: "Added posts", ResponseType: model.CommandResponseTypeEphemeral}, nil diff --git a/server/channels/app/slashcommands/command_remote.go b/server/channels/app/slashcommands/command_remote.go index 8568a530183..0fedee496ca 100644 --- a/server/channels/app/slashcommands/command_remote.go +++ b/server/channels/app/slashcommands/command_remote.go @@ -35,7 +35,6 @@ func (rp *RemoteProvider) GetTrigger() string { } func (rp *RemoteProvider) GetCommand(a *app.App, T i18n.TranslateFunc) *model.Command { - remote := model.NewAutocompleteData(rp.GetTrigger(), "[action]", T("api.command_remote.remote_add_remove.help", map[string]any{"Actions": AvailableRemoteActions})) create := model.NewAutocompleteData("create", "", T("api.command_remote.invite.help")) diff --git a/server/channels/app/slashcommands/command_share.go b/server/channels/app/slashcommands/command_share.go index 629c5debd52..1281253aabe 100644 --- a/server/channels/app/slashcommands/command_share.go +++ b/server/channels/app/slashcommands/command_share.go @@ -72,7 +72,6 @@ func (sp *ShareProvider) GetAutoCompleteListItems(c request.CTX, a *app.App, com case strings.Contains(parsed, " uninvite "): return sp.getAutoCompleteUnInviteRemote(a, commandArgs, arg) - } return nil, errors.New("invalid action") } diff --git a/server/channels/app/status_test.go b/server/channels/app/status_test.go index 247fb8555db..be66f510120 100644 --- a/server/channels/app/status_test.go +++ b/server/channels/app/status_test.go @@ -43,7 +43,6 @@ func TestCustomStatus(t *testing.T) { } func TestCustomStatusErrors(t *testing.T) { - fakeUserID := "foobar" mockErr := store.NewErrNotFound("User", fakeUserID) mockUser := &model.User{Id: fakeUserID} diff --git a/server/channels/app/support_packet.go b/server/channels/app/support_packet.go index f17b2d7eecf..433cc99cf80 100644 --- a/server/channels/app/support_packet.go +++ b/server/channels/app/support_packet.go @@ -231,7 +231,6 @@ func (a *App) generateSupportPacketYaml(c *request.Context) (*model.FileData, er } func (a *App) createPluginsFile(_ *request.Context) (*model.FileData, error) { - // Getting the plugins installed on the server, prettify it, and then add them to the file data array pluginsResponse, appErr := a.GetPlugins() if appErr != nil { @@ -248,7 +247,6 @@ func (a *App) createPluginsFile(_ *request.Context) (*model.FileData, error) { Body: pluginsPrettyJSON, } return fileData, nil - } func (a *App) getNotificationsLog(_ *request.Context) (*model.FileData, error) { diff --git a/server/channels/app/support_packet_test.go b/server/channels/app/support_packet_test.go index 6b543924f26..10089987642 100644 --- a/server/channels/app/support_packet_test.go +++ b/server/channels/app/support_packet_test.go @@ -83,7 +83,6 @@ func TestGenerateSupportPacketYaml(t *testing.T) { assert.Equal(t, "mock", packet.FileDriver) assert.Equal(t, "FAIL: all broken", packet.FileStatus) }) - } func TestGenerateSupportPacket(t *testing.T) { diff --git a/server/channels/app/team.go b/server/channels/app/team.go index 449acb2b7b5..cdc217aeb70 100644 --- a/server/channels/app/team.go +++ b/server/channels/app/team.go @@ -220,7 +220,6 @@ func (a *App) UpdateTeam(team *model.Team) (*model.Team, *model.AppError) { // RenameTeam is used to rename the team Name and the DisplayName fields func (a *App) RenameTeam(team *model.Team, newTeamName string, newDisplayName string) (*model.Team, *model.AppError) { - // check if name is occupied _, errnf := a.GetTeamByName(newTeamName) @@ -1574,7 +1573,6 @@ func (a *App) InviteGuestsToChannelsGracefully(teamID string, guestsInvite *mode } else { inviteListWithErrors[i].Error = model.NewAppError("InviteGuestsToChannelsGracefully", "api.team.invite_members.unable_to_send_email.app_error", nil, "", http.StatusInternalServerError) } - } } case errors.Is(eErr, email.NoRateLimiterError): diff --git a/server/channels/app/team_test.go b/server/channels/app/team_test.go index 92cdd81c6c7..4ebe652b264 100644 --- a/server/channels/app/team_test.go +++ b/server/channels/app/team_test.go @@ -466,7 +466,6 @@ func TestAddUserToTeamByTeamId(t *testing.T) { require.NotNil(t, err, "Should not add restricted user") require.Equal(t, "JoinUserToTeam", err.Where, "Error should be JoinUserToTeam") }) - } func TestAdjustTeamsFromProductLimits(t *testing.T) { @@ -522,7 +521,6 @@ func TestAdjustTeamsFromProductLimits(t *testing.T) { }) t.Run("Should not do anything if the amount of teams is equal to the limit", func(t *testing.T) { - expectedTeamsList, err := th.App.GetAllTeams() var expectedActiveTeams []*model.Team @@ -590,7 +588,6 @@ func TestAdjustTeamsFromProductLimits(t *testing.T) { }) t.Run("Should only restore teams that were archived by cloud limits", func(t *testing.T) { - activeLimit := 1 teamLimits := &model.TeamsLimits{Active: &activeLimit} @@ -622,7 +619,6 @@ func TestAdjustTeamsFromProductLimits(t *testing.T) { require.Equal(t, int64(0), teamsList[1].DeleteAt) require.Equal(t, int64(0), teamsList[2].DeleteAt) }) - } func TestPermanentDeleteTeam(t *testing.T) { @@ -1205,7 +1201,6 @@ func TestGetTeamMembers(t *testing.T) { }) t.Run("Ensure Sorted By User ID when no TeamMemberGetOptions is passed", func(t *testing.T) { - // Sort them by UserID because the result of GetTeamMembers() is also sorted sort.Slice(users, func(i, j int) bool { return users[i].Id < users[j].Id diff --git a/server/channels/app/true_up.go b/server/channels/app/true_up.go index 50f87871a41..7bad3766c4b 100644 --- a/server/channels/app/true_up.go +++ b/server/channels/app/true_up.go @@ -46,7 +46,6 @@ func (a *App) getMarketplacePlugins() ([]string, error) { } func (a *App) getTrueUpProfile() (*model.TrueUpReviewProfile, error) { - license := a.Channels().License() if license == nil { return nil, model.NewAppError("requestTrueUpReview", "api.license.true_up_review.license_required", nil, "Could not get the total active users count", http.StatusInternalServerError) @@ -117,7 +116,6 @@ func (a *App) getTrueUpProfile() (*model.TrueUpReviewProfile, error) { } return &reviewProfile, nil - } func (a *App) GetTrueUpProfile() (map[string]any, error) { diff --git a/server/channels/app/user.go b/server/channels/app/user.go index 77469e5a21a..a2c4b7e0a96 100644 --- a/server/channels/app/user.go +++ b/server/channels/app/user.go @@ -807,7 +807,6 @@ func (a *App) UpdateDefaultProfileImage(c request.CTX, user *model.User) *model. } func (a *App) SetDefaultProfileImage(c request.CTX, user *model.User) *model.AppError { - if err := a.UpdateDefaultProfileImage(c, user); err != nil { c.Logger().Error("Failed to update default profile image for user", mlog.String("user_id", user.Id), mlog.Err(err)) return err @@ -1598,7 +1597,6 @@ func (a *App) UpdateUserRoles(c request.CTX, userID string, newRoles string, sen } func (a *App) UpdateUserRolesWithUser(c request.CTX, user *model.User, newRoles string, sendWebSocketEvent bool) (*model.User, *model.AppError) { - if err := a.CheckRolesExist(strings.Fields(newRoles)); err != nil { return nil, err } diff --git a/server/channels/app/user_agent.go b/server/channels/app/user_agent.go index 42d56c7f054..a951100bcc1 100644 --- a/server/channels/app/user_agent.go +++ b/server/channels/app/user_agent.go @@ -150,5 +150,4 @@ func getBrowserName(ua *uasurfer.UserAgent, userAgentString string) string { } return browserNames[uasurfer.BrowserUnknown] - } diff --git a/server/channels/app/user_test.go b/server/channels/app/user_test.go index b9daabc0bc7..7732fd99dcb 100644 --- a/server/channels/app/user_test.go +++ b/server/channels/app/user_test.go @@ -576,7 +576,6 @@ func TestUpdateUserEmail(t *testing.T) { botuser2, appErr := th.App.UpdateUser(th.Context, &botuser, false) assert.Nil(t, appErr) assert.Equal(t, botuser2.Email, newBotEmail) - }) t.Run("RequireVerificationAlreadyUsedEmail", func(t *testing.T) { @@ -1171,7 +1170,6 @@ func TestPasswordRecovery(t *testing.T) { err = th.App.resetPasswordFromToken(th.Context, token.Token, "abcdefgh", model.GetMillisForTime(time.Now().Add(25*time.Hour))) assert.NotNil(t, err) }) - } func TestInvalidatePasswordRecoveryTokens(t *testing.T) { @@ -1742,7 +1740,6 @@ func TestPatchUser(t *testing.T) { } func TestUpdateThreadReadForUser(t *testing.T) { - t.Run("Ensure thread membership is created and followed", func(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() diff --git a/server/channels/app/users/password.go b/server/channels/app/users/password.go index e959ede2cc7..e187f6e0994 100644 --- a/server/channels/app/users/password.go +++ b/server/channels/app/users/password.go @@ -39,7 +39,6 @@ func ComparePassword(hash string, password string) error { } func (us *UserService) isPasswordValid(password string) error { - return IsPasswordValidWithSettings(password, &us.config().PasswordSettings) } diff --git a/server/channels/app/web_conn_test.go b/server/channels/app/web_conn_test.go index 3a60aa1e61f..c667f8cc6c1 100644 --- a/server/channels/app/web_conn_test.go +++ b/server/channels/app/web_conn_test.go @@ -186,5 +186,4 @@ func TestWebConnShouldSendEvent(t *testing.T) { event3 := model.NewWebSocketEvent(model.WebsocketEventUpdateTeam, "wrongId", "", "", nil, "") assert.False(t, basicUserWc.ShouldSendEvent(event3)) - } diff --git a/server/channels/app/webhook.go b/server/channels/app/webhook.go index bca2b42bff8..16862d93cd2 100644 --- a/server/channels/app/webhook.go +++ b/server/channels/app/webhook.go @@ -813,7 +813,6 @@ func (a *App) CreateCommandWebhook(commandID string, args *model.CommandArgs) (* default: return nil, model.NewAppError("CreateCommandWebhook", "app.command_webhook.create_command_webhook.internal_error", nil, "", http.StatusInternalServerError).Wrap(err) } - } return savedHook, nil } diff --git a/server/channels/app/webhook_test.go b/server/channels/app/webhook_test.go index 6632cfb9652..2ae65fe51be 100644 --- a/server/channels/app/webhook_test.go +++ b/server/channels/app/webhook_test.go @@ -584,11 +584,9 @@ func TestCreateOutGoingWebhookWithUsernameAndIconURL(t *testing.T) { assert.Equal(t, createdHook.IconURL, outgoingWebhook.IconURL) assert.Equal(t, createdHook.DisplayName, outgoingWebhook.DisplayName) assert.Equal(t, createdHook.Description, outgoingWebhook.Description) - } func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) { - getPayload := func(hook *model.OutgoingWebhook, th *TestHelper, channel *model.Channel) *model.OutgoingWebhookPayload { return &model.OutgoingWebhookPayload{ Token: hook.Token, @@ -647,7 +645,6 @@ func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) { } getTestCases := func() map[string]TestCaseOutgoing { - webHookResponse := "sample response text from test server" testCasesOutgoing := map[string]TestCaseOutgoing{ @@ -682,7 +679,6 @@ func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) { for name, testCase := range getTestCases() { t.Run(name, func(t *testing.T) { - th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true *cfg.ServiceSettings.EnablePostUsernameOverride = testCase.EnablePostUsernameOverride @@ -726,10 +722,8 @@ func TestTriggerOutGoingWebhookWithUsernameAndIconURL(t *testing.T) { case <-time.After(5 * time.Second): require.Fail(t, "Timeout, webhook response not created as post") } - }) } - } type InfiniteReader struct { diff --git a/server/channels/audit/audit_test.go b/server/channels/audit/audit_test.go index a488eee84ab..b79d5bbd559 100644 --- a/server/channels/audit/audit_test.go +++ b/server/channels/audit/audit_test.go @@ -38,7 +38,6 @@ func TestAudit_LogRecord(t *testing.T) { { "update user record, no error", func(audit Audit) { - usr := &model.User{} usr.Id = userId usr.Username = "TestABC" diff --git a/server/channels/jobs/notify_admin/install_plugin_scheduler.go b/server/channels/jobs/notify_admin/install_plugin_scheduler.go index 32c3af42037..d339e949733 100644 --- a/server/channels/jobs/notify_admin/install_plugin_scheduler.go +++ b/server/channels/jobs/notify_admin/install_plugin_scheduler.go @@ -21,5 +21,4 @@ func MakeInstallPluginScheduler(jobServer *jobs.JobServer, license *model.Licens return enabled } return jobs.NewPeriodicScheduler(jobServer, jobType, installPluginSchedFreq, isEnabled) - } diff --git a/server/channels/jobs/notify_admin/scheduler.go b/server/channels/jobs/notify_admin/scheduler.go index 30a7698e09a..0f628959658 100644 --- a/server/channels/jobs/notify_admin/scheduler.go +++ b/server/channels/jobs/notify_admin/scheduler.go @@ -21,5 +21,4 @@ func MakeScheduler(jobServer *jobs.JobServer, license *model.License, jobType st return enabled } return jobs.NewPeriodicScheduler(jobServer, jobType, schedFreq, isEnabled) - } diff --git a/server/channels/jobs/resend_invitation_email/worker.go b/server/channels/jobs/resend_invitation_email/worker.go index e3815726ec9..a2d4c930ce1 100644 --- a/server/channels/jobs/resend_invitation_email/worker.go +++ b/server/channels/jobs/resend_invitation_email/worker.go @@ -167,7 +167,6 @@ func (rseworker *ResendInvitationEmailWorker) GetDurations(job *model.Job) (int6 } return elapsedTimeSinceSchedule, DurationInMillis - } func (rseworker *ResendInvitationEmailWorker) TearDown(logger mlog.LoggerIFace, job *model.Job) { diff --git a/server/channels/store/localcachelayer/channel_layer.go b/server/channels/store/localcachelayer/channel_layer.go index 134912cc7c4..2a9df8d3abe 100644 --- a/server/channels/store/localcachelayer/channel_layer.go +++ b/server/channels/store/localcachelayer/channel_layer.go @@ -157,7 +157,6 @@ func (s LocalCacheChannelStore) GetPinnedPostCount(channelId string, allowFromCa } func (s LocalCacheChannelStore) Get(id string, allowFromCache bool) (*model.Channel, error) { - if allowFromCache { var cacheItem *model.Channel if err := s.rootStore.doStandardReadCache(s.rootStore.channelByIdCache, id, &cacheItem); err == nil { diff --git a/server/channels/store/localcachelayer/post_layer_test.go b/server/channels/store/localcachelayer/post_layer_test.go index 19e9caa8e70..a964c44613e 100644 --- a/server/channels/store/localcachelayer/post_layer_test.go +++ b/server/channels/store/localcachelayer/post_layer_test.go @@ -190,6 +190,5 @@ func TestPostStoreCache(t *testing.T) { _, _ = cachedStore.Post().GetPosts(fakeOptions, true, map[string]bool{}) mockStore.Post().(*mocks.PostStore).AssertNumberOfCalls(t, "GetPosts", 1) - }) } diff --git a/server/channels/store/localcachelayer/team_layer_test.go b/server/channels/store/localcachelayer/team_layer_test.go index 74b7ff7f822..dd3c4e22178 100644 --- a/server/channels/store/localcachelayer/team_layer_test.go +++ b/server/channels/store/localcachelayer/team_layer_test.go @@ -73,5 +73,4 @@ func TestTeamStoreCache(t *testing.T) { assert.Equal(t, fakeUserTeamIds, gotUserTeamIds) mockStore.Team().(*mocks.TeamStore).AssertNumberOfCalls(t, "GetUserTeamIds", 2) }) - } diff --git a/server/channels/store/localcachelayer/terms_of_service_layer_test.go b/server/channels/store/localcachelayer/terms_of_service_layer_test.go index 2f81a869838..202a71c7551 100644 --- a/server/channels/store/localcachelayer/terms_of_service_layer_test.go +++ b/server/channels/store/localcachelayer/terms_of_service_layer_test.go @@ -19,7 +19,6 @@ func TestTermsOfServiceStore(t *testing.T) { } func TestTermsOfServiceStoreTermsOfServiceCache(t *testing.T) { - fakeTermsOfService := model.TermsOfService{Id: "123", CreateAt: 11111, UserId: "321", Text: "Terms of service test"} t.Run("first call by latest not cached, second cached and returning same data", func(t *testing.T) { diff --git a/server/channels/store/searchtest/file_info_layer.go b/server/channels/store/searchtest/file_info_layer.go index fef24a0655a..3ac205c78a8 100644 --- a/server/channels/store/searchtest/file_info_layer.go +++ b/server/channels/store/searchtest/file_info_layer.go @@ -1592,7 +1592,6 @@ func testFileInfoSupportWildcardOutsideQuotes(t *testing.T, th *SearchTestHelper require.Len(t, results.FileInfos, 1) th.checkFileInfoInSearchResults(t, p2.Id, results.FileInfos) }) - } func testFileInfoSlashShouldNotBeCharSeparator(t *testing.T, th *SearchTestHelper) { diff --git a/server/channels/store/searchtest/helper.go b/server/channels/store/searchtest/helper.go index ecf44850720..de37fdb32ee 100644 --- a/server/channels/store/searchtest/helper.go +++ b/server/channels/store/searchtest/helper.go @@ -326,7 +326,6 @@ func (th *SearchTestHelper) createGroupChannel(teamID, displayName string, users } return channel, nil - } func (th *SearchTestHelper) deleteChannel(channel *model.Channel) error { diff --git a/server/channels/store/searchtest/post_layer.go b/server/channels/store/searchtest/post_layer.go index 59129b770f7..859ffb003f9 100644 --- a/server/channels/store/searchtest/post_layer.go +++ b/server/channels/store/searchtest/post_layer.go @@ -1767,7 +1767,6 @@ func testSupportWildcardOutsideQuotes(t *testing.T, th *SearchTestHelper) { require.Len(t, results.Posts, 1) th.checkPostInSearchResults(t, p2.Id, results.Posts) }) - } func testHashtagSearchShouldSupportThreeOrMoreCharacters(t *testing.T, th *SearchTestHelper) { diff --git a/server/channels/store/searchtest/testlib.go b/server/channels/store/searchtest/testlib.go index 3777a9544a0..e92b3e31607 100644 --- a/server/channels/store/searchtest/testlib.go +++ b/server/channels/store/searchtest/testlib.go @@ -60,7 +60,6 @@ func runTestSearch(t *testing.T, testEngine *SearchTestEngine, tests []searchTes filteredTests := filterTestsByTag(tests, testEngine.Driver) for _, test := range filteredTests { - if test.Skip { t.Log("SKIPPED: " + test.Name + ". Reason: " + test.SkipMessage) continue diff --git a/server/channels/store/sqlstore/channel_store.go b/server/channels/store/sqlstore/channel_store.go index 81d3f51795f..60b2780ea75 100644 --- a/server/channels/store/sqlstore/channel_store.go +++ b/server/channels/store/sqlstore/channel_store.go @@ -683,7 +683,6 @@ func (s SqlChannelStore) SaveDirectChannel(directChannel *model.Channel, member1 } return newChannel, nil - } func (s SqlChannelStore) saveChannelT(transaction *sqlxTxWrapper, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) { @@ -2971,7 +2970,6 @@ func (s SqlChannelStore) GetForPost(postId string) (*model.Channel, error) { Channels.Id = Posts.ChannelId AND Posts.Id = ?`, postId); err != nil { return nil, errors.Wrapf(err, "failed to get Channel with postId=%s", postId) - } return &channel, nil } @@ -3526,7 +3524,6 @@ func (s SqlChannelStore) channelSearchQuery(opts *store.ChannelSearchOpts) sq.Se query = query. LeftJoin("RetentionPoliciesChannels ON c.Id = RetentionPoliciesChannels.ChannelId"). Where("RetentionPoliciesChannels.ChannelId IS NULL") - } else { query = query.Where(sq.Expr(`c.Id NOT IN (SELECT ChannelId FROM RetentionPoliciesChannels)`)) } @@ -3770,7 +3767,6 @@ func (s SqlChannelStore) buildFulltextClauseX(term string, searchColumns ...stri expr := fmt.Sprintf("((to_tsvector('%[1]s', %[2]s)) @@ to_tsquery('%[1]s', ?))", s.pgDefaultTextSearchConfig, strings.Join(searchColumns, " || ' ' || ")) return sq.Expr(expr, fulltextTerm) - } splitTerm := strings.Fields(fulltextTerm) @@ -3846,7 +3842,6 @@ func (s SqlChannelStore) searchGroupChannelsQuery(userId, term string, isPostgre return s.getQueryBuilder().Select("*"). From("Channels"). Where(sq.Expr("Id IN (?)", subq)) - } baseLikeTerm = "GROUP_CONCAT(u.Username SEPARATOR ', ') LIKE ?" @@ -4067,7 +4062,6 @@ func (s SqlChannelStore) MigrateChannelMembers(fromChannelId string, fromUserId WHERE ChannelId=:ChannelId AND UserId=:UserId`, &member); err != nil { return nil, errors.Wrap(err, "failed to update ChannelMember") } - } if err := transaction.Commit(); err != nil { diff --git a/server/channels/store/sqlstore/integrity_test.go b/server/channels/store/sqlstore/integrity_test.go index 76b61ad2cc7..26c5b072573 100644 --- a/server/channels/store/sqlstore/integrity_test.go +++ b/server/channels/store/sqlstore/integrity_test.go @@ -421,7 +421,6 @@ func TestCheckChannelsCommandWebhooksIntegrity(t *testing.T) { require.NoError(t, result.Err) data := result.Data.(model.RelationalIntegrityCheckData) require.Empty(t, data.Records) - }) t.Run("should generate a report with one record", func(t *testing.T) { channelId := model.NewId() diff --git a/server/channels/store/sqlstore/license_store.go b/server/channels/store/sqlstore/license_store.go index d58d7c27e54..8c62d6f06ef 100644 --- a/server/channels/store/sqlstore/license_store.go +++ b/server/channels/store/sqlstore/license_store.go @@ -53,7 +53,6 @@ func (ls SqlLicenseStore) Save(license *model.LicenseRecord) error { } return nil - } // Get obtains the license with the provided id parameter from the database. diff --git a/server/channels/store/sqlstore/post_store.go b/server/channels/store/sqlstore/post_store.go index 33303c28c50..9120be25bc3 100644 --- a/server/channels/store/sqlstore/post_store.go +++ b/server/channels/store/sqlstore/post_store.go @@ -637,7 +637,6 @@ func (s *SqlPostStore) getPostWithCollapsedThreads(id, userID string, opts model sq.Lt{"Posts.Id": opts.FromPost}, }, }) - } else { query = query.Where(direction) } @@ -759,7 +758,6 @@ func (s *SqlPostStore) Get(ctx context.Context, id string, opts model.GetPostsOp sq.Lt{"p.Id": opts.FromPost}, }, }) - } else { query = query.Where(direction) } @@ -2220,7 +2218,6 @@ func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.A // TODO: convert to squirrel HW func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) { - var args []any query := `SELECT diff --git a/server/channels/store/sqlstore/preference_store.go b/server/channels/store/sqlstore/preference_store.go index 78fe05726c0..ba1712c3684 100644 --- a/server/channels/store/sqlstore/preference_store.go +++ b/server/channels/store/sqlstore/preference_store.go @@ -172,7 +172,6 @@ func (s SqlPreferenceStore) GetCategory(userId string, category string) (model.P return nil, errors.Wrapf(err, "failed to find Preference with userId=%s, category=%s", userId, category) } return preferences, nil - } func (s SqlPreferenceStore) GetAll(userId string) (model.Preferences, error) { @@ -205,7 +204,6 @@ func (s SqlPreferenceStore) PermanentDeleteByUser(userId string) error { } func (s SqlPreferenceStore) Delete(userId, category, name string) error { - sql, args, err := s.getQueryBuilder(). Delete("Preferences"). Where(sq.Eq{"UserId": userId}). @@ -224,7 +222,6 @@ func (s SqlPreferenceStore) Delete(userId, category, name string) error { } func (s SqlPreferenceStore) DeleteCategory(userId string, category string) error { - sql, args, err := s.getQueryBuilder(). Delete("Preferences"). Where(sq.Eq{"UserId": userId}). diff --git a/server/channels/store/sqlstore/store.go b/server/channels/store/sqlstore/store.go index 03a008bf14a..0115b052f58 100644 --- a/server/channels/store/sqlstore/store.go +++ b/server/channels/store/sqlstore/store.go @@ -440,7 +440,6 @@ func (ss *SqlStore) GetDbVersion(numerical bool) (string, error) { } return version, nil - } func (ss *SqlStore) GetMasterX() *sqlxDBWrapper { @@ -654,7 +653,6 @@ func (ss *SqlStore) DoesTableExist(tableName string) bool { } return count > 0 - } else if ss.DriverName() == model.DatabaseDriverMysql { var count int64 err := ss.GetMasterX().Get(&count, @@ -674,7 +672,6 @@ func (ss *SqlStore) DoesTableExist(tableName string) bool { } return count > 0 - } else { mlog.Fatal("Failed to check if column exists because of missing driver") return false @@ -703,7 +700,6 @@ func (ss *SqlStore) DoesColumnExist(tableName string, columnName string) bool { } return count > 0 - } else if ss.DriverName() == model.DatabaseDriverMysql { var count int64 err := ss.GetMasterX().Get(&count, @@ -724,7 +720,6 @@ func (ss *SqlStore) DoesColumnExist(tableName string, columnName string) bool { } return count > 0 - } else { mlog.Fatal("Failed to check if column exists because of missing driver") return false @@ -748,7 +743,6 @@ func (ss *SqlStore) DoesTriggerExist(triggerName string) bool { } return count > 0 - } else if ss.DriverName() == model.DatabaseDriverMysql { var count int64 err := ss.GetMasterX().Get(&count, ` @@ -766,7 +760,6 @@ func (ss *SqlStore) DoesTriggerExist(triggerName string) bool { } return count > 0 - } else { mlog.Fatal("Failed to check if column exists because of missing driver") return false @@ -774,7 +767,6 @@ func (ss *SqlStore) DoesTriggerExist(triggerName string) bool { } func (ss *SqlStore) CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool { - if ss.DoesColumnExist(tableName, columnName) { return false } @@ -786,7 +778,6 @@ func (ss *SqlStore) CreateColumnIfNotExists(tableName string, columnName string, } return true - } else if ss.DriverName() == model.DatabaseDriverMysql { _, err := ss.GetMasterX().ExecNoTimeout("ALTER TABLE " + tableName + " ADD " + columnName + " " + mySqlColType + " DEFAULT '" + defaultValue + "'") if err != nil { @@ -794,7 +785,6 @@ func (ss *SqlStore) CreateColumnIfNotExists(tableName string, columnName string, } return true - } else { mlog.Fatal("Failed to create column because of missing driver") return false @@ -1106,7 +1096,6 @@ func (ss *SqlStore) DropAllTables() { for _, t := range tables { if t != "db_migrations" { ss.masterX.Exec(`TRUNCATE TABLE ` + t) - } } } diff --git a/server/channels/store/sqlstore/store_test.go b/server/channels/store/sqlstore/store_test.go index e27af3da54a..84e9c7ca940 100644 --- a/server/channels/store/sqlstore/store_test.go +++ b/server/channels/store/sqlstore/store_test.go @@ -310,7 +310,6 @@ func TestGetReplica(t *testing.T) { for replica := range replicas { assert.NotSame(t, store.GetMasterX(), replica) } - } else if assert.Len(t, replicas, 1) { // Otherwise ensure the replicas contains only the master. for replica := range replicas { @@ -382,7 +381,6 @@ func TestGetReplica(t *testing.T) { for replica := range replicas { assert.Same(t, store.GetMasterX(), replica) } - } else if assert.Len(t, replicas, 1) { // Otherwise ensure the replicas contains only the master. for replica := range replicas { @@ -397,7 +395,6 @@ func TestGetReplica(t *testing.T) { for searchReplica := range searchReplicas { assert.Same(t, store.GetMasterX(), searchReplica) } - } else if testCase.DataSourceReplicaNum > 0 { assert.Equal(t, len(replicas), len(searchReplicas)) for k := range replicas { @@ -567,7 +564,6 @@ func TestIsBinaryParamEnabled(t *testing.T) { require.NoError(t, err) assert.Equal(t, tests[i].expected, ok) } - } func TestGetAllConns(t *testing.T) { diff --git a/server/channels/store/sqlstore/team_store.go b/server/channels/store/sqlstore/team_store.go index e13d1fc19c4..af2d62974a4 100644 --- a/server/channels/store/sqlstore/team_store.go +++ b/server/channels/store/sqlstore/team_store.go @@ -248,7 +248,6 @@ func (s SqlTeamStore) Save(team *model.Team) (*model.Team, error) { // if the team exists in the database. // It returns the updated team if the operation is successful. func (s SqlTeamStore) Update(team *model.Team) (*model.Team, error) { - team.PreUpdate() if err := team.IsValid(); err != nil { @@ -259,7 +258,6 @@ func (s SqlTeamStore) Update(team *model.Team) (*model.Team, error) { err := s.GetMasterX().Get(&oldTeam, `SELECT * FROM Teams WHERE Id=?`, team.Id) if err != nil { return nil, errors.Wrapf(err, "failed to get Team with id=%s", team.Id) - } if oldTeam.Id == "" { @@ -365,7 +363,6 @@ func (s SqlTeamStore) GetByEmptyInviteID() ([]*model.Team, error) { // If there is no match in the database, it returns a model.AppError with a // http.StatusNotFound in the StatusCode field. func (s SqlTeamStore) GetByName(name string) (*model.Team, error) { - team := model.Team{} query, args, err := s.teamsQuery.Where(sq.Eq{"Name": name}).ToSql() if err != nil { @@ -1337,7 +1334,6 @@ func (s SqlTeamStore) MigrateTeamMembers(fromTeamId string, fromUserId string) ( WHERE TeamId=:TeamId AND UserId=:UserId`, &member); err != nil { return nil, errors.Wrap(err, "failed to update TeamMember") } - } if err := transaction.Commit(); err != nil { @@ -1369,7 +1365,6 @@ func (s SqlTeamStore) InvalidateAllTeamIdsForUser(userId string) {} // ClearAllCustomRoleAssignments removes all custom role assignments from TeamMembers. func (s SqlTeamStore) ClearAllCustomRoleAssignments() (err error) { - builtInRoles := model.MakeDefaultRoles() lastUserId := strings.Repeat("0", 26) lastTeamId := strings.Repeat("0", 26) diff --git a/server/channels/store/sqlstore/thread_store.go b/server/channels/store/sqlstore/thread_store.go index 6672d12220f..5132a96dc44 100644 --- a/server/channels/store/sqlstore/thread_store.go +++ b/server/channels/store/sqlstore/thread_store.go @@ -587,7 +587,6 @@ func (s *SqlThreadStore) MarkAllAsReadByChannels(userID string, channelIDs []str var query sq.UpdateBuilder if s.DriverName() == model.DatabaseDriverPostgres { query = s.getQueryBuilder().Update("ThreadMemberships").From("Threads") - } else { query = s.getQueryBuilder().Update("ThreadMemberships", "Threads") } diff --git a/server/channels/store/sqlstore/user_access_token_store.go b/server/channels/store/sqlstore/user_access_token_store.go index 2e31def814f..5df301dffe4 100644 --- a/server/channels/store/sqlstore/user_access_token_store.go +++ b/server/channels/store/sqlstore/user_access_token_store.go @@ -57,11 +57,9 @@ func (s SqlUserAccessTokenStore) Delete(tokenId string) (err error) { } return nil - } func (s SqlUserAccessTokenStore) deleteSessionsAndTokensById(transaction *sqlxTxWrapper, tokenId string) error { - query := "" if s.DriverName() == model.DatabaseDriverPostgres { query = "DELETE FROM Sessions s USING UserAccessTokens o WHERE o.Token = s.Token AND o.Id = ?" @@ -77,7 +75,6 @@ func (s SqlUserAccessTokenStore) deleteSessionsAndTokensById(transaction *sqlxTx } func (s SqlUserAccessTokenStore) deleteTokensById(transaction *sqlxTxWrapper, tokenId string) error { - if _, err := transaction.Exec("DELETE FROM UserAccessTokens WHERE Id = ?", tokenId); err != nil { return errors.Wrapf(err, "failed to delete UserAccessToken id=%s", tokenId) } diff --git a/server/channels/store/sqlstore/user_store.go b/server/channels/store/sqlstore/user_store.go index e59d81e6483..3c86c880aa2 100644 --- a/server/channels/store/sqlstore/user_store.go +++ b/server/channels/store/sqlstore/user_store.go @@ -455,7 +455,6 @@ func (us SqlUserStore) Get(ctx context.Context, id string) (*model.User, error) return nil, store.NewErrNotFound("User", id) } return nil, errors.Wrapf(err, "failed to get User with userId=%s", id) - } if err = json.Unmarshal(props, &user.Props); err != nil { return nil, errors.Wrap(err, "failed to unmarshal user props") @@ -580,7 +579,6 @@ func applyMultiRoleFilters(query sq.SelectBuilder, systemRoles []string, teamRol sqOr = append(sqOr, sq.Like{"u.Roles": queryRole}) } } - } } @@ -1304,7 +1302,6 @@ func (us SqlUserStore) GetForLogin(loginId string, allowSignInWithUsername, allo } return users[0], nil - } func (us SqlUserStore) VerifyEmail(userId, email string) (string, error) { @@ -1378,7 +1375,6 @@ func (us SqlUserStore) Count(options model.UserCountOptions) (int64, error) { } func (us SqlUserStore) AnalyticsActiveCount(timePeriod int64, options model.UserCountOptions) (int64, error) { - time := model.GetMillis() - timePeriod query := us.getQueryBuilder().Select("COUNT(*)").From("Status AS s").Where("LastActivityAt > ?", time) diff --git a/server/channels/store/sqlstore/webhook_store.go b/server/channels/store/sqlstore/webhook_store.go index e912b440cb2..deb3a36eb30 100644 --- a/server/channels/store/sqlstore/webhook_store.go +++ b/server/channels/store/sqlstore/webhook_store.go @@ -131,7 +131,6 @@ func (s SqlWebhookStore) GetIncomingListByUser(userId string, offset, limit int) } return webhooks, nil - } func (s SqlWebhookStore) GetIncomingByTeamByUser(teamId string, userId string, offset, limit int) ([]*model.IncomingWebhook, error) { @@ -198,7 +197,6 @@ func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.Ou } func (s SqlWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) { - var webhook model.OutgoingWebhook if err := s.GetReplicaX().Get(&webhook, "SELECT * FROM OutgoingWebhooks WHERE Id = ? AND DeleteAt = 0", id); err != nil { @@ -240,7 +238,6 @@ func (s SqlWebhookStore) GetOutgoingListByUser(userId string, offset, limit int) func (s SqlWebhookStore) GetOutgoingList(offset, limit int) ([]*model.OutgoingWebhook, error) { return s.GetOutgoingListByUser("", offset, limit) - } func (s SqlWebhookStore) GetOutgoingByChannelByUser(channelId string, userId string, offset, limit int) ([]*model.OutgoingWebhook, error) { diff --git a/server/channels/store/storetest/channel_store.go b/server/channels/store/storetest/channel_store.go index 8823a000412..cd206740055 100644 --- a/server/channels/store/storetest/channel_store.go +++ b/server/channels/store/storetest/channel_store.go @@ -680,7 +680,6 @@ func testGetChannelsWithTeamDataByIds(t *testing.T, ss store.Store) { } func testChannelStoreGetForPost(t *testing.T, ss store.Store) { - ch := &model.Channel{ TeamId: model.NewId(), DisplayName: "Name", @@ -1032,7 +1031,6 @@ func testChannelStoreGetDeleted(t *testing.T, ss store.Store) { list, nErr = ss.Channel().GetDeleted(o1.TeamId, 1, 1, userId) require.NoError(t, nErr, nErr) require.Len(t, list, 1, "wrong list length") - } func testChannelMemberStore(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/emoji_store.go b/server/channels/store/storetest/emoji_store.go index 189500994c8..8e9446000fc 100644 --- a/server/channels/store/storetest/emoji_store.go +++ b/server/channels/store/storetest/emoji_store.go @@ -241,7 +241,6 @@ func testEmojiGetList(t *testing.T, ss store.Store) { assert.Equal(t, 2, len(remojis)) assert.Equal(t, emojis[1].Name, remojis[0].Name) assert.Equal(t, emojis[2].Name, remojis[1].Name) - } func testEmojiSearch(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/file_info_store.go b/server/channels/store/storetest/file_info_store.go index 6ee139e4ef6..5dc6f67bc1b 100644 --- a/server/channels/store/storetest/file_info_store.go +++ b/server/channels/store/storetest/file_info_store.go @@ -221,7 +221,6 @@ func testFileInfoGetForPost(t *testing.T, ss store.Store) { ) require.NoError(t, err) assert.Len(t, postInfos, tc.ExpectedPosts) - }) } } diff --git a/server/channels/store/storetest/plugin_store.go b/server/channels/store/storetest/plugin_store.go index 2eda0172963..d3d416fd7f1 100644 --- a/server/channels/store/storetest/plugin_store.go +++ b/server/channels/store/storetest/plugin_store.go @@ -1293,7 +1293,6 @@ func testPluginList(t *testing.T, ss store.Store) { if i%10 == 0 { // Expire keys 0, 10, 20, ... expireAt = 1 - } else if (i+5)%10 == 0 { // Mark for future expiry keys 5, 15, 25, ... expireAt = now + 5*60*1000 diff --git a/server/channels/store/storetest/post_priority_store.go b/server/channels/store/storetest/post_priority_store.go index b162812574d..858b28c7fe4 100644 --- a/server/channels/store/storetest/post_priority_store.go +++ b/server/channels/store/storetest/post_priority_store.go @@ -20,7 +20,6 @@ func TestPostPriorityStore(t *testing.T, ss store.Store, s SqlStore) { } func testPostPriorityStoreGetForPost(t *testing.T, ss store.Store) { - t.Run("Save post priority when in post's metadata", func(t *testing.T) { p1 := model.Post{} p1.ChannelId = model.NewId() diff --git a/server/channels/store/storetest/post_store.go b/server/channels/store/storetest/post_store.go index c52083b71e5..caa995939eb 100644 --- a/server/channels/store/storetest/post_store.go +++ b/server/channels/store/storetest/post_store.go @@ -4402,7 +4402,6 @@ func testPostStoreGetRepliesForExport(t *testing.T, ss store.Store) { assert.Equal(t, reply1.Id, p2.Id) assert.Equal(t, reply1.Message, p2.Message) assert.Equal(t, reply1.Username, u1.Username) - } func testPostStoreGetDirectPostParentsForExportAfter(t *testing.T, ss store.Store, s SqlStore) { @@ -5095,5 +5094,4 @@ func testGetEditHistoryForPost(t *testing.T, ss store.Store) { _, err = ss.Post().GetEditHistoryForPost(savedUpdatedPost.Id) require.NoError(t, err) }) - } diff --git a/server/channels/store/storetest/preference_store.go b/server/channels/store/storetest/preference_store.go index ad2dcc25534..76f1a4eb446 100644 --- a/server/channels/store/storetest/preference_store.go +++ b/server/channels/store/storetest/preference_store.go @@ -191,7 +191,6 @@ func testPreferenceGetAll(t *testing.T, ss store.Store) { for i := 0; i < 3; i++ { assert.Falsef(t, result[0] != preferences[i] && result[1] != preferences[i] && result[2] != preferences[i], "got incorrect preferences") } - } func testPreferenceDeleteByUser(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/product_notices_store.go b/server/channels/store/storetest/product_notices_store.go index 68ad7f1bcac..b68ab2ee56e 100644 --- a/server/channels/store/storetest/product_notices_store.go +++ b/server/channels/store/storetest/product_notices_store.go @@ -76,5 +76,4 @@ func testClearOld(t *testing.T, ss store.Store) { res, err := ss.ProductNotices().GetViews("testuser") require.NoError(t, err) require.Len(t, res, 1) - } diff --git a/server/channels/store/storetest/reaction_store.go b/server/channels/store/storetest/reaction_store.go index 0b4b3cb4d0a..72792d39e22 100644 --- a/server/channels/store/storetest/reaction_store.go +++ b/server/channels/store/storetest/reaction_store.go @@ -382,7 +382,6 @@ func testReactionGetForPostSince(t *testing.T, ss store.Store, s SqlStore) { for _, r := range returned { assert.Zero(t, r.DeleteAt, "should not have returned deleted reaction") } - }) t.Run("reactions since, incl deleted", func(t *testing.T) { @@ -397,7 +396,6 @@ func testReactionGetForPostSince(t *testing.T, ss store.Store, s SqlStore) { } } assert.Equal(t, 1, count, "should not have returned 1 deleted reaction") - }) t.Run("reactions since, filter remoteId", func(t *testing.T) { @@ -561,7 +559,6 @@ func testReactionDeleteAllWithEmojiName(t *testing.T, ss store.Store, s SqlStore postList, err = ss.Post().Get(context.Background(), post3.Id, model.GetPostsOptions{}, "", map[string]bool{}) require.NoError(t, err) assert.False(t, postList.Posts[post3.Id].HasReactions, "post shouldn't have reactions any more") - } func testPermanentDeleteByUser(t *testing.T, ss store.Store) { @@ -805,7 +802,6 @@ func testReactionBulkGetForPosts(t *testing.T, ss store.Store) { } require.False(t, post4IdFound, "Wrong reaction returned") - } // testReactionDeadlock is a best-case attempt to recreate the deadlock scenario. diff --git a/server/channels/store/storetest/remote_cluster_store.go b/server/channels/store/storetest/remote_cluster_store.go index 82965a7ba20..02d062cce93 100644 --- a/server/channels/store/storetest/remote_cluster_store.go +++ b/server/channels/store/storetest/remote_cluster_store.go @@ -26,7 +26,6 @@ func TestRemoteClusterStore(t *testing.T, ss store.Store) { } func testRemoteClusterSave(t *testing.T, ss store.Store) { - t.Run("Save", func(t *testing.T) { rc := &model.RemoteCluster{ Name: "some_remote", diff --git a/server/channels/store/storetest/team_store.go b/server/channels/store/storetest/team_store.go index 53d92f95117..cc54bb7f9f2 100644 --- a/server/channels/store/storetest/team_store.go +++ b/server/channels/store/storetest/team_store.go @@ -3198,7 +3198,6 @@ func testGetChannelUnreadsForTeam(t *testing.T, ss store.Store) { } func testUpdateLastTeamIconUpdate(t *testing.T, ss store.Store) { - // team icon initially updated a second ago lastTeamIconUpdateInitial := model.GetMillis() - 1000 diff --git a/server/channels/store/storetest/thread_store.go b/server/channels/store/storetest/thread_store.go index 3845df0aa79..d215c39ee62 100644 --- a/server/channels/store/storetest/thread_store.go +++ b/server/channels/store/storetest/thread_store.go @@ -33,7 +33,6 @@ func TestThreadStore(t *testing.T, ss store.Store, s SqlStore) { func testThreadStorePopulation(t *testing.T, ss store.Store) { makeSomePosts := func(urgent bool) []*model.Post { - u1 := model.User{ Email: MakeEmail(), Username: model.NewId(), diff --git a/server/channels/store/storetest/true_up_review_store.go b/server/channels/store/storetest/true_up_review_store.go index c2cde1dd166..e48e7c6ea98 100644 --- a/server/channels/store/storetest/true_up_review_store.go +++ b/server/channels/store/storetest/true_up_review_store.go @@ -21,7 +21,6 @@ func TestTrueUpReviewStatusStore(t *testing.T, ss store.Store, s SqlStore) { } func testCreateTrueUpReviewStatus(t *testing.T, ss store.Store) { - now := time.Date(time.Now().Year(), time.January, 1, 0, 0, 0, 0, time.Local) reviewStatus := model.TrueUpReviewStatus{ @@ -39,7 +38,6 @@ func testCreateTrueUpReviewStatus(t *testing.T, ss store.Store) { } func testGetTrueUpReviewStatus(t *testing.T, ss store.Store) { - now := time.Date(time.Now().Year(), time.August, 1, 0, 0, 0, 0, time.Local) dueDate := utils.GetNextTrueUpReviewDueDate(now).UnixMilli() @@ -61,7 +59,6 @@ func testGetTrueUpReviewStatus(t *testing.T, ss store.Store) { } func testUpdateTrueUpReviewStatus(t *testing.T, ss store.Store) { - now := time.Date(time.Now().Year(), time.April, 1, 0, 0, 0, 0, time.Local) reviewStatus := model.TrueUpReviewStatus{ diff --git a/server/channels/store/storetest/user_store.go b/server/channels/store/storetest/user_store.go index baf55221930..6b89cebe15e 100644 --- a/server/channels/store/storetest/user_store.go +++ b/server/channels/store/storetest/user_store.go @@ -1035,7 +1035,6 @@ func testUserStoreGetProfilesInChannel(t *testing.T, ss store.Store) { } func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, ss store.Store, s SqlStore) { - cleanupStatusStore(t, s) teamId := model.NewId() @@ -1114,7 +1113,6 @@ func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, ss store.Store, s Sq } func testUserStoreGetProfilesInChannelByStatus(t *testing.T, ss store.Store, s SqlStore) { - cleanupStatusStore(t, s) teamId := model.NewId() @@ -2553,7 +2551,6 @@ func testUserStoreUpdateMfaActive(t *testing.T, ss store.Store) { } func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, ss store.Store, s SqlStore) { - cleanupStatusStore(t, s) teamId := model.NewId() @@ -4268,7 +4265,6 @@ func testCount(t *testing.T, ss store.Store) { } func testUserStoreAnalyticsActiveCount(t *testing.T, ss store.Store, s SqlStore) { - cleanupStatusStore(t, s) // Create 5 users statuses u0, u1, u2, u3, u4. @@ -4353,7 +4349,6 @@ func testUserStoreAnalyticsActiveCount(t *testing.T, ss store.Store, s SqlStore) } func testUserStoreAnalyticsActiveCountForPeriod(t *testing.T, ss store.Store, s SqlStore) { - cleanupStatusStore(t, s) // Create 5 users statuses u0, u1, u2, u3, u4. @@ -4482,7 +4477,6 @@ func testUserStoreAnalyticsGetSystemAdminCount(t *testing.T, ss store.Store) { result, err := ss.User().AnalyticsGetSystemAdminCount() require.NoError(t, err) require.Equal(t, countBefore+1, result, "Did not get the expected number of system admins.") - } func testUserStoreAnalyticsGetGuestCount(t *testing.T, ss store.Store) { diff --git a/server/channels/store/storetest/webhook_store.go b/server/channels/store/storetest/webhook_store.go index d9ffcb2704b..9a0e4707fef 100644 --- a/server/channels/store/storetest/webhook_store.go +++ b/server/channels/store/storetest/webhook_store.go @@ -53,7 +53,6 @@ func testWebhookStoreSaveIncoming(t *testing.T, ss store.Store) { } func testWebhookStoreUpdateIncoming(t *testing.T, ss store.Store) { - var err error o1 := buildIncomingWebhook() diff --git a/server/channels/testlib/resources.go b/server/channels/testlib/resources.go index d9cd279071c..022d8870f80 100644 --- a/server/channels/testlib/resources.go +++ b/server/channels/testlib/resources.go @@ -171,7 +171,6 @@ func SetupTestResources() (string, error) { } else { return "", errors.Wrapf(err, "Invalid action: %d", testResource.action) } - } return tempDir, nil diff --git a/server/channels/utils/merge.go b/server/channels/utils/merge.go index 8071ec59ec3..6bee5ca4f1d 100644 --- a/server/channels/utils/merge.go +++ b/server/channels/utils/merge.go @@ -119,7 +119,6 @@ func merge(base, patch reflect.Value, mergeConfig *MergeConfig) (reflect.Value, // use base merged := reflect.MakeSlice(commonType, 0, base.Len()) for i := 0; i < base.Len(); i++ { - // recursively merge base with itself. This will clone reference values. val, _ := merge(base.Index(i), base.Index(i), mergeConfig) merged = reflect.Append(merged, val) diff --git a/server/channels/utils/merge_test.go b/server/channels/utils/merge_test.go index 17b6ebe0e9c..8c9c922763a 100644 --- a/server/channels/utils/merge_test.go +++ b/server/channels/utils/merge_test.go @@ -258,7 +258,6 @@ func TestMergeWithMaps(t *testing.T) { // test replacing a referenced map m1["base"] = map[string]*int{"third": newInt(777)} assert.Equal(t, 10, *merged["base"]["level"]) - }) t.Run("merge map[string]map[string]*int, pointers are not copied - change in patch do not affect merged", func(t *testing.T) { @@ -661,7 +660,6 @@ func TestMergeWithEvenSimpler(t *testing.T) { *t1.ES2.S = "new base" assert.Equal(t, "base", *merged.ES2.S) }) - } type sliceStruct struct { diff --git a/server/channels/utils/subpath.go b/server/channels/utils/subpath.go index 77288fa54cc..e1799099817 100644 --- a/server/channels/utils/subpath.go +++ b/server/channels/utils/subpath.go @@ -104,7 +104,6 @@ func UpdateAssetsSubpathInDir(subpath, directory string) error { // will have affected the script, so look for the new subpath, not the old one. oldScript := getSubpathScript(subpath) newRootHTML = strings.Replace(newRootHTML, fmt.Sprintf("", oldScript), "", 1) - } else if !alreadyRewritten && subpath != "/" { // Otherwise, inject the script to define `window.publicPath`. script := getSubpathScript(subpath) diff --git a/server/channels/utils/urlencode_test.go b/server/channels/utils/urlencode_test.go index a70c6cd134b..3fbff54b2fe 100644 --- a/server/channels/utils/urlencode_test.go +++ b/server/channels/utils/urlencode_test.go @@ -10,7 +10,6 @@ import ( ) func TestURLEncode(t *testing.T) { - toEncode := "testing 1 2 3" encoded := URLEncode(toEncode) diff --git a/server/channels/utils/utils.go b/server/channels/utils/utils.go index ede1c4b2498..09b20007561 100644 --- a/server/channels/utils/utils.go +++ b/server/channels/utils/utils.go @@ -102,7 +102,6 @@ func GetIPAddress(r *http.Request, trustedProxyIPHeader []string) string { if address != "" && net.ParseIP(address) != nil { return address } - } host, _, _ := net.SplitHostPort(r.RemoteAddr) diff --git a/server/channels/web/context.go b/server/channels/web/context.go index 215afb6a0c6..cdea7d5752a 100644 --- a/server/channels/web/context.go +++ b/server/channels/web/context.go @@ -127,7 +127,6 @@ func (c *Context) SessionRequired() { if !*c.App.Config().ServiceSettings.EnableUserAccessTokens && c.AppContext.Session().Props[model.SessionPropType] == model.SessionTypeUserAccessToken && c.AppContext.Session().Props[model.SessionPropIsBot] != model.SessionPropIsBotValue { - c.Err = model.NewAppError("", "api.context.session_expired.app_error", nil, "UserAccessToken", http.StatusUnauthorized) return } diff --git a/server/channels/web/handlers_test.go b/server/channels/web/handlers_test.go index cb9fa99eec2..5fd88a288a0 100644 --- a/server/channels/web/handlers_test.go +++ b/server/channels/web/handlers_test.go @@ -451,7 +451,6 @@ func TestHandlerServeCSPHeader(t *testing.T) { assert.Equal(t, 200, response.Code) assert.Equal(t, []string{"frame-ancestors " + frameAncestors + "; script-src 'self' cdn.rudderlabs.com js.stripe.com/v3 'unsafe-eval' 'unsafe-inline'"}, response.Header()["Content-Security-Policy"]) }) - } func TestGenerateDevCSP(t *testing.T) { diff --git a/server/channels/web/static.go b/server/channels/web/static.go index dd8cbd8eb06..baa80b09b8c 100644 --- a/server/channels/web/static.go +++ b/server/channels/web/static.go @@ -60,7 +60,6 @@ func (w *Web) InitStatic() { } func root(c *Context, w http.ResponseWriter, r *http.Request) { - if !CheckClientCompatibility(r.UserAgent()) { w.Header().Set("Cache-Control", "no-store") data := renderUnsupportedBrowser(c.AppContext, r) diff --git a/server/channels/web/unsupported_browser.go b/server/channels/web/unsupported_browser.go index f30fbef9d7a..7bd69fe0e73 100644 --- a/server/channels/web/unsupported_browser.go +++ b/server/channels/web/unsupported_browser.go @@ -45,7 +45,6 @@ type SystemBrowser struct { } func renderUnsupportedBrowser(ctx *request.Context, r *http.Request) templates.Data { - data := templates.Data{ Props: map[string]any{ "DownloadAppOrUpgradeBrowserString": ctx.T("web.error.unsupported_browser.download_app_or_upgrade_browser"), @@ -89,7 +88,6 @@ func renderUnsupportedBrowser(ctx *request.Context, r *http.Request) templates.D } return data - } func renderMattermostAppMac(ctx *request.Context) MattermostApp { diff --git a/server/cmd/mattermost/commands/utils_test.go b/server/cmd/mattermost/commands/utils_test.go index 94e01ea8814..a3c0318dba9 100644 --- a/server/cmd/mattermost/commands/utils_test.go +++ b/server/cmd/mattermost/commands/utils_test.go @@ -67,7 +67,6 @@ func TestPrintMap(t *testing.T) { if !reflect.DeepEqual(slice1, slice2) { t.Errorf("got '%#v' want '%#v", slice1, slice2) } - }) } } diff --git a/server/cmd/mmctl/commands/root_test.go b/server/cmd/mmctl/commands/root_test.go index 903bfbfd9d1..b3bf87423d5 100644 --- a/server/cmd/mmctl/commands/root_test.go +++ b/server/cmd/mmctl/commands/root_test.go @@ -12,7 +12,6 @@ import ( ) func executeRawCommand(root *cobra.Command, args string) (c *cobra.Command, output string, err error) { - actual := new(bytes.Buffer) RootCmd.SetOut(actual) RootCmd.SetErr(actual) @@ -22,7 +21,6 @@ func executeRawCommand(root *cobra.Command, args string) (c *cobra.Command, outp } func (s *MmctlUnitTestSuite) TestArgumentsHaveWhitespaceTrimmed() { - arguments := []string{"value_1", "value_2"} lineEndings := []string{"\n", "\r", "\r\n"} prettyNames := []string{"-n", "-r", "-r-n"} @@ -35,7 +33,6 @@ func (s *MmctlUnitTestSuite) TestArgumentsHaveWhitespaceTrimmed() { commandFunction := func(command *cobra.Command, args []string) { commandCalled = true s.Equal(arguments, args, "Expected arguments to have their whitespace trimmed") - } mockCommand := &cobra.Command{Use: "test", Run: commandFunction} commandString := strings.Join([]string{"test", " ", arguments[0], lineEnding, " ", arguments[1], lineEnding}, "") @@ -44,5 +41,4 @@ func (s *MmctlUnitTestSuite) TestArgumentsHaveWhitespaceTrimmed() { s.Require().True(commandCalled, "Expected mock command to be called") }) } - } diff --git a/server/config/database_test.go b/server/config/database_test.go index e525f6c6a40..d1d5365c66c 100644 --- a/server/config/database_test.go +++ b/server/config/database_test.go @@ -640,7 +640,6 @@ func TestDatabaseStoreSet(t *testing.T) { assert.Equal(t, "http://minimal", *ds.Get().ServiceSettings.SiteURL) assertDatabaseEqualsConfig(t, minimalConfig) }) - } func TestDatabaseStoreLoad(t *testing.T) { diff --git a/server/config/file.go b/server/config/file.go index 40910bc7648..e12c1e3cb40 100644 --- a/server/config/file.go +++ b/server/config/file.go @@ -130,7 +130,6 @@ func (fs *FileStore) Load() ([]byte, error) { f, err := os.Open(fs.path) if os.IsNotExist(err) { return nil, nil - } else if err != nil { return nil, errors.Wrapf(err, "failed to open %s for reading", fs.path) } diff --git a/server/config/file_test.go b/server/config/file_test.go index db696e0311e..13cfaed1b74 100644 --- a/server/config/file_test.go +++ b/server/config/file_test.go @@ -1007,7 +1007,6 @@ func TestFileGetFile(t *testing.T) { require.NoError(t, err) require.Equal(t, []byte("new file"), data) }) - } func TestFileSetFile(t *testing.T) { @@ -1141,7 +1140,6 @@ func TestFileHasFile(t *testing.T) { require.NoError(t, err) require.True(t, has) }) - } func TestFileRemoveFile(t *testing.T) { @@ -1226,7 +1224,6 @@ func TestFileRemoveFile(t *testing.T) { has, err := fs.HasFile(filename) require.NoError(t, err) require.True(t, has) - }) } diff --git a/server/config/logger_test.go b/server/config/logger_test.go index d415fd6b120..fbc51507d38 100644 --- a/server/config/logger_test.go +++ b/server/config/logger_test.go @@ -49,5 +49,4 @@ func TestMloggerConfigFromAuditConfig(t *testing.T) { require.NoError(t, err, "unmarshal should not fail") assert.Equal(t, optionsExpected, optionsReceived) }) - } diff --git a/server/config/memory.go b/server/config/memory.go index 24434a35e44..4fb4bf0f16b 100644 --- a/server/config/memory.go +++ b/server/config/memory.go @@ -76,7 +76,6 @@ func (ms *MemoryStore) Load() ([]byte, error) { } return cfgBytes, nil - } // GetFile fetches the contents of a previously persisted configuration file. diff --git a/server/platform/services/cache/lru_test.go b/server/platform/services/cache/lru_test.go index 4ccfcaf7819..b91ce4c8719 100644 --- a/server/platform/services/cache/lru_test.go +++ b/server/platform/services/cache/lru_test.go @@ -80,7 +80,6 @@ func TestLRU(t *testing.T) { err = l.Get("201", &v) require.NoError(t, err) require.Equal(t, 301, v) - } func TestLRUExpire(t *testing.T) { @@ -291,7 +290,6 @@ func TestLRUMarshalUnMarshal(t *testing.T) { } func BenchmarkLRU(b *testing.B) { - value1 := "simplestring" b.Run("simple=new", func(b *testing.B) { diff --git a/server/platform/services/httpservice/client_test.go b/server/platform/services/httpservice/client_test.go index 4d35b0ac164..0af7fd77517 100644 --- a/server/platform/services/httpservice/client_test.go +++ b/server/platform/services/httpservice/client_test.go @@ -53,7 +53,6 @@ func TestHTTPClient(t *testing.T) { } else { require.Error(t, err) } - }) } }) diff --git a/server/platform/services/imageproxy/atmos_camo_test.go b/server/platform/services/imageproxy/atmos_camo_test.go index 4ada5cd0141..f1c1d20fc40 100644 --- a/server/platform/services/imageproxy/atmos_camo_test.go +++ b/server/platform/services/imageproxy/atmos_camo_test.go @@ -185,5 +185,4 @@ func TestGetAtmosCamoImageURL(t *testing.T) { assert.Equal(t, test.Expected, backend.getAtmosCamoImageURL(test.Input)) }) } - } diff --git a/server/platform/services/imageproxy/local.go b/server/platform/services/imageproxy/local.go index dba0d80f2d1..a01c1549735 100644 --- a/server/platform/services/imageproxy/local.go +++ b/server/platform/services/imageproxy/local.go @@ -297,7 +297,6 @@ func newProxyRequest(r *http.Request, baseURL *url.URL) (*proxyRequest, error) { if err != nil { return nil, URLError{fmt.Sprintf("unable to parse remote URL: %v", err), r.URL} } - } if baseURL != nil { diff --git a/server/platform/services/telemetry/telemetry_test.go b/server/platform/services/telemetry/telemetry_test.go index 13a2cff9ab7..fb08fe55dd3 100644 --- a/server/platform/services/telemetry/telemetry_test.go +++ b/server/platform/services/telemetry/telemetry_test.go @@ -95,7 +95,6 @@ func collectBatches(t *testing.T, info *[]testBatch, pchan chan testTelemetryPay } func makeTelemetryServiceAndReceiver(t *testing.T, cloudLicense bool) (*TelemetryService, chan testTelemetryPayload, *model.Config, func()) { - cfg := &model.Config{} cfg.SetDefaults() serverIfaceMock, storeMock, deferredAssertions, cleanUp := initializeMocks(cfg, cloudLicense) diff --git a/server/platform/shared/filestore/s3store.go b/server/platform/shared/filestore/s3store.go index 95008e1c1de..bae0281fdd0 100644 --- a/server/platform/shared/filestore/s3store.go +++ b/server/platform/shared/filestore/s3store.go @@ -577,7 +577,6 @@ func (b *S3FileBackend) AppendFile(fr io.Reader, path string) (int64, error) { return 0, errors.Wrapf(err, "unable append the data in the file %s", path) } return info.Size, nil - } func (b *S3FileBackend) RemoveFile(path string) error { diff --git a/server/platform/shared/mail/inbucket.go b/server/platform/shared/mail/inbucket.go index 3bd8134ba6b..166448bbebe 100644 --- a/server/platform/shared/mail/inbucket.go +++ b/server/platform/shared/mail/inbucket.go @@ -53,7 +53,6 @@ func ParseEmail(email string) string { } func GetMailBox(email string) (results JSONMessageHeaderInbucket, err error) { - parsedEmail := ParseEmail(email) url := fmt.Sprintf("%s%s%s", getInbucketHost(), InbucketAPI, parsedEmail) @@ -132,7 +131,6 @@ func downloadAttachment(url string) ([]byte, error) { } func DeleteMailBox(email string) (err error) { - parsedEmail := ParseEmail(email) url := fmt.Sprintf("%s%s%s", getInbucketHost(), InbucketAPI, parsedEmail) @@ -171,7 +169,6 @@ func RetryInbucket(attempts int, callback func() error) (err error) { } func getInbucketHost() (host string) { - inbucket_host := os.Getenv("CI_INBUCKET_HOST") if inbucket_host == "" { inbucket_host = "localhost" diff --git a/server/public/model/access.go b/server/public/model/access.go index c373f645234..5128e85a4e9 100644 --- a/server/public/model/access.go +++ b/server/public/model/access.go @@ -59,7 +59,6 @@ func (ad *AccessData) IsValid() *AppError { } func (ad *AccessData) IsExpired() bool { - if ad.ExpiresAt <= 0 { return false } diff --git a/server/public/model/authorize.go b/server/public/model/authorize.go index 1a767e3c217..e206757c5d3 100644 --- a/server/public/model/authorize.go +++ b/server/public/model/authorize.go @@ -36,7 +36,6 @@ type AuthorizeRequest struct { // IsValid validates the AuthData and returns an error if it isn't configured // correctly. func (ad *AuthData) IsValid() *AppError { - if !IsValidId(ad.ClientId) { return NewAppError("AuthData.IsValid", "model.authorize.is_valid.client_id.app_error", nil, "", http.StatusBadRequest) } @@ -75,7 +74,6 @@ func (ad *AuthData) IsValid() *AppError { // IsValid validates the AuthorizeRequest and returns an error if it isn't configured // correctly. func (ar *AuthorizeRequest) IsValid() *AppError { - if !IsValidId(ar.ClientId) { return NewAppError("AuthData.IsValid", "model.authorize.is_valid.client_id.app_error", nil, "", http.StatusBadRequest) } diff --git a/server/public/model/authorize_test.go b/server/public/model/authorize_test.go index 35c8fc19dab..3d482a19dfc 100644 --- a/server/public/model/authorize_test.go +++ b/server/public/model/authorize_test.go @@ -19,7 +19,6 @@ func TestAuthPreSave(t *testing.T) { } func TestAuthIsValid(t *testing.T) { - ad := AuthData{} require.NotNil(t, ad.IsValid()) diff --git a/server/public/model/bot.go b/server/public/model/bot.go index 5a5ce4970d4..5f176d5f728 100644 --- a/server/public/model/bot.go +++ b/server/public/model/bot.go @@ -205,7 +205,6 @@ func (l *BotList) Etag() string { t = v.UpdateAt id = v.UserId } - } return Etag(id, t, delta, len(*l)) diff --git a/server/public/model/channel_list.go b/server/public/model/channel_list.go index 05bcac8b716..a343b977b41 100644 --- a/server/public/model/channel_list.go +++ b/server/public/model/channel_list.go @@ -6,7 +6,6 @@ package model type ChannelList []*Channel func (o *ChannelList) Etag() string { - id := "0" var t int64 var delta int64 @@ -21,7 +20,6 @@ func (o *ChannelList) Etag() string { t = v.UpdateAt id = v.Id } - } return Etag(id, t, delta, len(*o)) @@ -30,7 +28,6 @@ func (o *ChannelList) Etag() string { type ChannelListWithTeamData []*ChannelWithTeamData func (o *ChannelListWithTeamData) Etag() string { - id := "0" var t int64 var delta int64 diff --git a/server/public/model/client4_test.go b/server/public/model/client4_test.go index 6632b02b0ec..e1365b4b0f6 100644 --- a/server/public/model/client4_test.go +++ b/server/public/model/client4_test.go @@ -126,7 +126,6 @@ func TestClient4RequestCancellation(t *testing.T) { }) t.Run("cancel after making the reqeust", func(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(100 * time.Millisecond) t.Fatal("request should not hit the server") @@ -144,7 +143,6 @@ func TestClient4RequestCancellation(t *testing.T) { assert.Nil(t, resp) done <- struct{}{} - }() cancel() diff --git a/server/public/model/command_autocomplete.go b/server/public/model/command_autocomplete.go index d1fd08243db..9b7dec08f97 100644 --- a/server/public/model/command_autocomplete.go +++ b/server/public/model/command_autocomplete.go @@ -213,7 +213,6 @@ func (ad *AutocompleteData) UpdateRelativeURLsForPluginCommands(baseURL *url.URL absURL.Path = path.Join(absURL.Path, dynamicList.FetchURL) dynamicList.FetchURL = absURL.String() } - } for _, command := range ad.SubCommands { err := command.UpdateRelativeURLsForPluginCommands(baseURL) diff --git a/server/public/model/compliance_post.go b/server/public/model/compliance_post.go index 5c859ffedf4..f86ab2fe64a 100644 --- a/server/public/model/compliance_post.go +++ b/server/public/model/compliance_post.go @@ -76,7 +76,6 @@ func cleanComplianceStrings(in string) string { } func (cp *CompliancePost) Row() []string { - postDeleteAt := "" if cp.PostDeleteAt > 0 { postDeleteAt = time.Unix(0, cp.PostDeleteAt*int64(1000*1000)).Format(time.RFC3339) diff --git a/server/public/model/config.go b/server/public/model/config.go index 0a799a356c7..69ed3319bce 100644 --- a/server/public/model/config.go +++ b/server/public/model/config.go @@ -2090,7 +2090,6 @@ func (s *AnnouncementSettings) SetDefaults() { if s.NoticesFetchFrequency == nil { s.NoticesFetchFrequency = NewInt(AnnouncementSettingsDefaultNoticesFetchFrequencySeconds) } - } type ThemeSettings struct { @@ -2146,7 +2145,6 @@ type TeamSettings struct { } func (s *TeamSettings) SetDefaults() { - if s.SiteName == nil || *s.SiteName == "" { s.SiteName = NewString(TeamSettingsDefaultSiteName) } diff --git a/server/public/model/config_test.go b/server/public/model/config_test.go index 20497d13498..4858f60f0b3 100644 --- a/server/public/model/config_test.go +++ b/server/public/model/config_test.go @@ -50,7 +50,6 @@ func TestConfigDefaults(t *testing.T) { if assert.False(t, v.IsNil(), "%s should be non-nil after SetDefaults()", name) { recursivelyUninitialize(config, fmt.Sprintf("(*%s)", name), v.Elem()) } - } else if v.Type().Kind() == reflect.Struct { for i := 0; i < v.NumField(); i++ { recursivelyUninitialize(config, fmt.Sprintf("%s.%s", name, v.Type().Field(i).Name), v.Field(i)) @@ -728,7 +727,6 @@ func TestDisplaySettingsIsValidCustomURLSchemes(t *testing.T) { } func TestListenAddressIsValidated(t *testing.T) { - testValues := map[string]bool{ ":8065": true, ":9917": true, @@ -766,7 +764,6 @@ func TestListenAddressIsValidated(t *testing.T) { require.Equal(t, "model.config.is_valid.listen_address.app_error", appErr.Message) } } - } func TestImageProxySettingsSetDefaults(t *testing.T) { @@ -1332,7 +1329,6 @@ func TestSetDefaultFeatureFlagBehaviour(t *testing.T) { cfg.SetDefaults() require.NotNil(t, cfg.FeatureFlags) require.Equal(t, "somevalue", cfg.FeatureFlags.TestFeature) - } func TestConfigImportSettingsDefaults(t *testing.T) { diff --git a/server/public/model/group.go b/server/public/model/group.go index 50d7d93ec4e..b4d1423237f 100644 --- a/server/public/model/group.go +++ b/server/public/model/group.go @@ -243,7 +243,6 @@ func (group *Group) IsValidForUpdate() *AppError { var validGroupnameChars = regexp.MustCompile(`^[a-z0-9\.\-_]+$`) func (group *Group) IsValidName() *AppError { - if group.Name == nil { if group.AllowReference { return NewAppError("Group.IsValidName", "model.group.name.app_error", map[string]any{"GroupNameMaxLength": GroupNameMaxLength}, "", http.StatusBadRequest) diff --git a/server/public/model/incoming_webhook.go b/server/public/model/incoming_webhook.go index bfd314d5774..47dfa235de1 100644 --- a/server/public/model/incoming_webhook.go +++ b/server/public/model/incoming_webhook.go @@ -61,7 +61,6 @@ type IncomingWebhookRequest struct { func (o *IncomingWebhook) IsValid() *AppError { if !IsValidId(o.Id) { return NewAppError("IncomingWebhook.IsValid", "model.incoming_hook.id.app_error", nil, "", http.StatusBadRequest) - } if o.CreateAt == 0 { diff --git a/server/public/model/license_test.go b/server/public/model/license_test.go index 5b413e00a37..5d50c20c1b0 100644 --- a/server/public/model/license_test.go +++ b/server/public/model/license_test.go @@ -227,7 +227,6 @@ func TestIsLegacyTrialRequest(t *testing.T) { legacyTr.ContactName = "" assert.True(t, legacyTr.IsLegacy()) }) - } func TestTrialLicenseRequestIsValid(t *testing.T) { @@ -439,7 +438,6 @@ func TestLicense_IsSanctionedTrial(t *testing.T) { } func TestLicenseHasSharedChannels(t *testing.T) { - testCases := []struct { description string license License diff --git a/server/public/model/link_metadata_test.go b/server/public/model/link_metadata_test.go index 12836ec11c9..4d8b8bcec58 100644 --- a/server/public/model/link_metadata_test.go +++ b/server/public/model/link_metadata_test.go @@ -293,7 +293,6 @@ func TestFirstNImages(t *testing.T) { } assert.Len(t, firstNImages(six, -10), LinkMetadataMaxImages, "On negative, go for defaults") }) - } func TestTruncateOpenGraph(t *testing.T) { diff --git a/server/public/model/oauth.go b/server/public/model/oauth.go index 911e484321b..dc2c1bad6d5 100644 --- a/server/public/model/oauth.go +++ b/server/public/model/oauth.go @@ -51,7 +51,6 @@ func (a *OAuthApp) Auditable() map[string]interface{} { // IsValid validates the app and returns an error if it isn't configured // correctly. func (a *OAuthApp) IsValid() *AppError { - if !IsValidId(a.Id) { return NewAppError("OAuthApp.IsValid", "model.oauth.is_valid.app_id.app_error", nil, "", http.StatusBadRequest) } diff --git a/server/public/model/outgoing_webhook.go b/server/public/model/outgoing_webhook.go index 794b79e1757..76835830392 100644 --- a/server/public/model/outgoing_webhook.go +++ b/server/public/model/outgoing_webhook.go @@ -96,7 +96,6 @@ func (o *OutgoingWebhookPayload) ToFormValues() string { } func (o *OutgoingWebhook) IsValid() *AppError { - if !IsValidId(o.Id) { return NewAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.id.app_error", nil, "", http.StatusBadRequest) } diff --git a/server/public/model/post_list.go b/server/public/model/post_list.go index 18279ec684e..76c701b5458 100644 --- a/server/public/model/post_list.go +++ b/server/public/model/post_list.go @@ -113,7 +113,6 @@ func (o *PostList) MakeNonNil() { } func (o *PostList) AddOrder(id string) { - if o.Order == nil { o.Order = make([]string, 0, 128) } @@ -122,7 +121,6 @@ func (o *PostList) AddOrder(id string) { } func (o *PostList) AddPost(post *Post) { - if o.Posts == nil { o.Posts = make(map[string]*Post) } @@ -162,7 +160,6 @@ func (o *PostList) SortByCreateAt() { } func (o *PostList) Etag() string { - id := "0" var t int64 diff --git a/server/public/model/post_test.go b/server/public/model/post_test.go index 1e47c52bd57..02760c215ad 100644 --- a/server/public/model/post_test.go +++ b/server/public/model/post_test.go @@ -971,5 +971,4 @@ func TestPostForPlugin(t *testing.T) { pluginPost := p.ForPlugin() require.NotNil(t, pluginPost.GetProp("requested_features")) }) - } diff --git a/server/public/model/push_notification_test.go b/server/public/model/push_notification_test.go index d4876c0a0f3..3d59e74017d 100644 --- a/server/public/model/push_notification_test.go +++ b/server/public/model/push_notification_test.go @@ -10,7 +10,6 @@ import ( ) func TestPushNotificationDeviceId(t *testing.T) { - msg := PushNotification{Platform: "test"} msg.SetDeviceIdAndPlatform("android:12345") diff --git a/server/public/model/search_params_test.go b/server/public/model/search_params_test.go index a3a36ba0792..ed61b63edb5 100644 --- a/server/public/model/search_params_test.go +++ b/server/public/model/search_params_test.go @@ -113,7 +113,6 @@ func TestSplitWords(t *testing.T) { assert.Equal(t, testCase.Output, splitWords(testCase.Input)) }) } - } func TestParseSearchFlags2(t *testing.T) { diff --git a/server/public/model/session.go b/server/public/model/session.go index 51a747e2e07..1d791fcf2dd 100644 --- a/server/public/model/session.go +++ b/server/public/model/session.go @@ -140,7 +140,6 @@ func (s *Session) Sanitize() { } func (s *Session) IsExpired() bool { - if s.ExpiresAt <= 0 { return false } @@ -153,7 +152,6 @@ func (s *Session) IsExpired() bool { } func (s *Session) AddProp(key string, value string) { - if s.Props == nil { s.Props = make(map[string]string) } diff --git a/server/public/model/user.go b/server/public/model/user.go index 2eb2c2db922..daf8c77cddb 100644 --- a/server/public/model/user.go +++ b/server/public/model/user.go @@ -796,7 +796,6 @@ func (u *User) GetRawRoles() string { } func IsValidUserRoles(userRoles string) bool { - roles := strings.Fields(userRoles) for _, r := range roles { diff --git a/server/public/model/utils.go b/server/public/model/utils.go index 9b73f489f20..621e00428c1 100644 --- a/server/public/model/utils.go +++ b/server/public/model/utils.go @@ -82,13 +82,11 @@ func (sa StringArray) Contains(input string) bool { return false } func (sa StringArray) Equals(input StringArray) bool { - if len(sa) != len(input) { return false } for index := range sa { - if sa[index] != input[index] { return false } @@ -586,7 +584,6 @@ func GetServerIPAddress(iface string) string { } for _, addr := range addrs { - if ip, ok := addr.(*net.IPNet); ok && !ip.IP.IsLoopback() && !ip.IP.IsLinkLocalUnicast() && !ip.IP.IsLinkLocalMulticast() { if ip.IP.To4() != nil { return ip.IP.String() @@ -664,7 +661,6 @@ func IsValidAlphaNumHyphenUnderscorePlus(s string) bool { } func Etag(parts ...any) string { - etag := CurrentVersion for _, part := range parts { diff --git a/server/public/model/utils_test.go b/server/public/model/utils_test.go index 406aa95865d..bea7b55b9d4 100644 --- a/server/public/model/utils_test.go +++ b/server/public/model/utils_test.go @@ -183,7 +183,6 @@ func TestCopyStringMap(t *testing.T) { } func TestMapJson(t *testing.T) { - m := make(map[string]string) m["id"] = "test_id" json := MapToJSON(m) diff --git a/server/public/plugin/checker/internal/asthelpers/helpers.go b/server/public/plugin/checker/internal/asthelpers/helpers.go index 5ba4d4017b3..f689bbc0bc6 100644 --- a/server/public/plugin/checker/internal/asthelpers/helpers.go +++ b/server/public/plugin/checker/internal/asthelpers/helpers.go @@ -65,7 +65,6 @@ func FindMethodsCalledOnType(info *types.Info, typ types.Type, caller *ast.FuncD ast.Inspect(caller, func(n ast.Node) bool { if s, ok := n.(*ast.SelectorExpr); ok { - var receiver *ast.Ident switch r := s.X.(type) { case *ast.Ident: @@ -90,7 +89,6 @@ func FindMethodsCalledOnType(info *types.Info, typ types.Type, caller *ast.FuncD } return false } - } return true }) diff --git a/server/public/plugin/client_rpc.go b/server/public/plugin/client_rpc.go index fd666a3a9c6..c3d5f503942 100644 --- a/server/public/plugin/client_rpc.go +++ b/server/public/plugin/client_rpc.go @@ -652,7 +652,6 @@ func (s *hooksRPCServer) MessageWillBePosted(args *Z_MessageWillBePostedArgs, re MessageWillBePosted(c *Context, post *model.Post) (*model.Post, string) }); ok { returns.A, returns.B = hook.MessageWillBePosted(args.A, args.B) - } else { return encodableError(fmt.Errorf("hook MessageWillBePosted called but not implemented")) } @@ -693,7 +692,6 @@ func (s *hooksRPCServer) MessageWillBeUpdated(args *Z_MessageWillBeUpdatedArgs, MessageWillBeUpdated(c *Context, newPost, oldPost *model.Post) (*model.Post, string) }); ok { returns.A, returns.B = hook.MessageWillBeUpdated(args.A, args.B, args.C) - } else { return encodableError(fmt.Errorf("hook MessageWillBeUpdated called but not implemented")) } @@ -715,7 +713,6 @@ func (g *apiRPCClient) LogDebug(msg string, keyValuePairs ...any) { if err := g.client.Call("Plugin.LogDebug", _args, _returns); err != nil { log.Printf("RPC call to LogDebug API failed: %s", err.Error()) } - } func (s *apiRPCServer) LogDebug(args *Z_LogDebugArgs, returns *Z_LogDebugReturns) error { @@ -744,7 +741,6 @@ func (g *apiRPCClient) LogInfo(msg string, keyValuePairs ...any) { if err := g.client.Call("Plugin.LogInfo", _args, _returns); err != nil { log.Printf("RPC call to LogInfo API failed: %s", err.Error()) } - } func (s *apiRPCServer) LogInfo(args *Z_LogInfoArgs, returns *Z_LogInfoReturns) error { @@ -773,7 +769,6 @@ func (g *apiRPCClient) LogWarn(msg string, keyValuePairs ...any) { if err := g.client.Call("Plugin.LogWarn", _args, _returns); err != nil { log.Printf("RPC call to LogWarn API failed: %s", err.Error()) } - } func (s *apiRPCServer) LogWarn(args *Z_LogWarnArgs, returns *Z_LogWarnReturns) error { diff --git a/server/public/plugin/interface_generator/main.go b/server/public/plugin/interface_generator/main.go index 0ca598d4c02..c34380a1867 100644 --- a/server/public/plugin/interface_generator/main.go +++ b/server/public/plugin/interface_generator/main.go @@ -128,7 +128,6 @@ func FieldListToEncodedErrors(structPrefix string, fieldList *ast.FieldList, fil } result = append(result, structPrefix+name+" = encodableError("+structPrefix+name+")") - } return strings.Join(result, "\n") diff --git a/server/public/shared/markdown/text_range_test.go b/server/public/shared/markdown/text_range_test.go index f29bece3261..13a804b1a2c 100644 --- a/server/public/shared/markdown/text_range_test.go +++ b/server/public/shared/markdown/text_range_test.go @@ -108,8 +108,6 @@ func TestTextRanges(t *testing.T) { }) assert.Equal(t, tc.ExpectedRanges, ranges) assert.Equal(t, tc.ExpectedValues, values) - }) } - } diff --git a/server/public/shared/timezones/timezones_test.go b/server/public/shared/timezones/timezones_test.go index 6749ba68b2d..68e2e0df276 100644 --- a/server/public/shared/timezones/timezones_test.go +++ b/server/public/shared/timezones/timezones_test.go @@ -29,5 +29,4 @@ func TestDefaultUserTimezone(t *testing.T) { require.Equal(t, "true", defaultTimezone2["useAutomaticTimezone"]) require.Empty(t, defaultTimezone2["automaticTimezone"]) require.Empty(t, defaultTimezone2["manualTimezone"]) - }