From 3ea0c498361e40a23b5e5c3781efe4cc7baf1725 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 19 Jun 2024 22:49:31 +0200 Subject: [PATCH] golangci-lint: enable depguard for packages that moved Prevent accidental imports of the packages that moved to a separate module, but that are now an alias. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 136e1b72d8330d43b9cedf051a0b745cf70df9ee) Signed-off-by: Sebastiaan van Stijn --- .golangci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 3af30512cc..fa057e5585 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,6 @@ linters: enable: + - depguard # Checks for imports that shouldn't be used. - exportloopref # Checks for pointers to enclosing loop variables - gofmt - goimports @@ -48,6 +49,17 @@ issues: text: "redefines-builtin-id" linters-settings: + depguard: + rules: + main: + deny: + - pkg: "github.com/containerd/containerd/errdefs" + desc: The containerd errdefs package was migrated to a separate module. Use github.com/containerd/errdefs instead. + - pkg: "github.com/containerd/containerd/log" + desc: The containerd log package was migrated to a separate module. Use github.com/containerd/log instead. + # TODO: enable once 1.6 migrated to github.com/containerd/platforms + # - pkg: "github.com/containerd/containerd/platforms" + # desc: The containerd platforms package was migrated to a separate module. Use github.com/containerd/platforms instead. gosec: # The following issues surfaced when `gosec` linter # was enabled. They are temporarily excluded to unblock