MM-60797: Fix errcheck issues in support_packet_test.go (#30607)

Fixes https://github.com/mattermost/mattermost/issues/29102

- Fix error handling in fileutils.FindDir() call by properly checking the returned boolean value
- Add proper error handling for SetPhase2PermissionsMigrationStatus calls
- Remove channels/app/support_packet_test.go from the errcheck exception list in .golangci.yml

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
Этот коммит содержится в:
Ben Schumacher
2025-04-09 14:10:08 +02:00
коммит произвёл GitHub
родитель 204fec42e9
Коммит 02e5c56d22
2 изменённых файлов: 6 добавлений и 4 удалений

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

@@ -110,7 +110,6 @@ issues:
channels/app/slashcommands/auto_environment.go|\
channels/app/slashcommands/command_test.go|\
channels/app/slashcommands/helper_test.go|\
channels/app/support_packet_test.go|\
channels/app/team.go|\
channels/app/team_test.go|\
channels/app/upload.go|\

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

@@ -25,7 +25,8 @@ func TestGenerateSupportPacket(t *testing.T) {
th := Setup(t)
defer th.TearDown()
th.App.SetPhase2PermissionsMigrationStatus(true)
err := th.App.SetPhase2PermissionsMigrationStatus(true)
require.NoError(t, err)
dir, err := os.MkdirTemp("", "")
require.NoError(t, err)
@@ -295,7 +296,8 @@ func TestGetPluginsFile(t *testing.T) {
})
t.Run("two plugins are installed", func(t *testing.T) {
path, _ := fileutils.FindDir("tests")
path, found := fileutils.FindDir("tests")
require.True(t, found, "tests directory not found")
bundle1, err := os.ReadFile(filepath.Join(path, "testplugin.tar.gz"))
require.NoError(t, err)
@@ -577,7 +579,8 @@ func TestGetSupportPacketPermissionsInfo(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.App.SetPhase2PermissionsMigrationStatus(true)
err := th.App.SetPhase2PermissionsMigrationStatus(true)
require.NoError(t, err)
generatePermissionInfo := func(t *testing.T) *model.SupportPacketPermissionInfo {
t.Helper()