Skip to content

Commit

Permalink
Update depguard rules to prevent breaking CGO_ENABLED=0 (#47298)
Browse files Browse the repository at this point in the history
* 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
(#47045). This was
fixed in #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
  • Loading branch information
rosstimothy authored Oct 10, 2024
1 parent baad15f commit 92faa33
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92faa33

Please sign in to comment.