From 92faa33c2eb3f8b1ea5408733171fb880012af9d Mon Sep 17 00:00:00 2001 From: rosstimothy <39066650+rosstimothy@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:46:52 +0000 Subject: [PATCH] Update depguard rules to prevent breaking CGO_ENABLED=0 (#47298) * Update depguard rules to prevent breaking CGO_ENABLED=0 The integrations binaries should be able to compile without CGO, however, a recent change introduced a dependency that required CGO (https://github.com/gravitational/teleport/pull/47045). This was fixed in https://github.com/gravitational/teleport/pull/47172, however there were no safety measure put in place to prevent it from happening again in the future. This updates the existing CGO depguard rules to apply to all files under integrations in addition to denying lib/config which requires CGO by way of lib/pam and lib/backend/lite. * sort cgo rules alphabetically and include backend/lite * only depguard integrations and not lib/integrations --- .golangci.yml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8ae2ad85cf05b..dd70e4302e6d3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -155,29 +155,35 @@ linters-settings: - "!$test" - '**/tool/tbot/**' - '**/lib/client/**' + - '!**/lib/integrations/**' + - '**/integrations/**' deny: + - pkg: github.com/gravitational/teleport/lib/bpf + desc: '"lib/bpf" requires CGO' + - pkg: github.com/gravitational/teleport/lib/backend/lite + desc: '"lib/backend/lite" requires CGO' + - pkg: github.com/gravitational/teleport/lib/cgroup + desc: '"lib/cgroup" requires CGO' + - pkg: github.com/gravitational/teleport/lib/config + desc: '"lib/config" requires CGO via "lib/pam" and "lib/backend/lite"' + - pkg: github.com/gravitational/teleport/lib/desktop/rdp/rdpclient + desc: '"lib/desktop/rdp/rdpclient" requires CGO' - pkg: github.com/gravitational/teleport/lib/devicetrust/authn$ - desc: '"devicetrust/authn" requires CGO on darwin' + desc: '"lib/devicetrust/authn" requires CGO on darwin' - pkg: github.com/gravitational/teleport/lib/devicetrust/enroll - desc: '"devicetrust/enroll" requires CGO on darwin' + desc: '"lib/devicetrust/enroll" requires CGO on darwin' - pkg: github.com/gravitational/teleport/lib/devicetrust/native - desc: '"devicetrust/native" requires CGO on darwin' - - pkg: github.com/gravitational/teleport/lib/bpf - desc: '"lib/bpf" requires CGO' - - pkg: github.com/gravitational/teleport/lib/vnet/daemon - desc: '"vnet/daemon" requires CGO' - - pkg: github.com/gravitational/teleport/lib/system/signal - desc: '"lib/system/signal" requires CGO' + desc: '"lib/devicetrust/native" requires CGO on darwin' - pkg: github.com/gravitational/teleport/lib/inventory/metadata desc: '"lib/inventory/metadata" requires CGO' - - pkg: github.com/gravitational/teleport/lib/desktop/rdp/rdpclient - desc: '"lib/desktop/rdp/rdpclient" requires CGO' - pkg: github.com/gravitational/teleport/lib/pam desc: '"lib/pam" requires CGO' - pkg: github.com/gravitational/teleport/lib/srv/uacc desc: '"lib/srv/uacc" requires CGO' - - pkg: github.com/gravitational/teleport/lib/cgroup - desc: '"lib/cgroup" requires CGO' + - pkg: github.com/gravitational/teleport/lib/system/signal + desc: '"lib/system/signal" requires CGO' + - pkg: github.com/gravitational/teleport/lib/vnet/daemon + desc: '"vnet/daemon" requires CGO' errorlint: comparison: true asserts: true