diff --git a/.golangci.yml b/.golangci.yml index ecc5e7c8e253f..1216efe780026 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -128,6 +128,64 @@ linters-settings: desc: 'use "log/slog" instead' - pkg: golang.org/x/exp/slog desc: 'use "log/slog" instead' + # Prevent importing any additional logging libraries. + testify: + files: + # Tests can import testify + - '!$test' + # Execptions + # Remove these once they are complaint. + - '!**/e/lib/auth/ssotestlib.go' + - '!**/e/lib/aws/identitycenter/test/**' + - '!**/e/lib/idp/saml/testenv/**' + - '!**/e/lib/operatortest/**' + - '!**/e/tests/**' + - '!**/lib/automaticupgrades/basichttp/servermock.go' + - '!**/lib/auth/helpers.go' + - '!**/lib/auth/keystore/testhelpers.go' + - '!**/lib/auth/test/**' + - '!**/lib/backend/test/**' + - '!**/lib/events/athena/test.go' + - '!**/lib/events/test/**' + - '!**/lib/kube/proxy/utils_testing.go' + - '!**/lib/services/suite/**' + - '!**/lib/srv/mock.go' + - '!**/lib/srv/db/redis/test.go' + - '!**/lib/teleterm/gatewaytest/**' + - '!**/lib/utils/testhelpers.go' + - '!**/lib/utils/testutils/**' + - '!**/integration/appaccess/fixtures.go' + - '!**/integration/appaccess/jwt.go' + - '!**/integration/appaccess/pack.go' + - '!**/integration/db/fixture.go' + - '!**/integration/hsm/helpers.go' + - '!**/integration/helpers/**' + - '!**/integration/proxy/proxy_helpers.go' + - '!**/integrations/access/email/testlib/**' + - '!**/integrations/access/datadog/testlib/**' + - '!**/integrations/access/discord/testlib/**' + - '!**/integrations/access/jira/testlib/**' + - '!**/integrations/access/mattermost/testlib/**' + - '!**/integrations/access/msteams/testlib/**' + - '!**/integrations/access/opsgenie/testlib/**' + - '!**/integrations/access/pagerduty/testlib/**' + - '!**/integrations/access/servicenow/testlib/**' + - '!**/integrations/access/slack/testlib/**' + - '!**/integrations/lib/testing/integration/accessrequestsuite.go' + - '!**/integrations/lib/testing/integration/app.go' + - '!**/integrations/lib/testing/integration/authhelper.go' + - '!**/integrations/lib/testing/integration/suite.go' + - '!**/integrations/operator/controllers/resources/testlib/**' + - '!**/tool/teleport/testenv/**' + deny: + - pkg: github.com/stretchr/testify + desc: 'testify should not be imported outside of test code' + integration: + files: + - '!**/integration/**' + deny: + - pkg: github.com/gravitational/teleport/integration$ + desc: 'integration test could should not be imported outside of intergation tests' # Prevent importing internal packages in client tools or packages containing # common interfaces consumed by them that are known to bloat binaries or break builds # because they only support a single platform.