From 7ec647dbe9317d45ef9d20bc6d0fd3f967016deb Mon Sep 17 00:00:00 2001 From: Javier Palomo Almena Date: Fri, 21 Aug 2020 11:37:21 +0200 Subject: [PATCH] golangci: Use depguard to prevent using restricted packages (#7825) Enabling this linter in golangci will check that we are not using restricted packages, and when a match is found, it will provide a message suggesting the alternative package. In this particular case, we enable it for `sync/atomic`. Signed-off-by: Javier Palomo --- .golangci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 1bed66642..c19321d67 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,6 +4,7 @@ run: linters: enable: + - depguard - golint issues: @@ -13,5 +14,12 @@ issues: - errcheck linters-settings: + depguard: + list-type: blacklist + include-go-root: true + packages: + - sync/atomic + packages-with-error-message: + - sync/atomic: "Use go.uber.org/atomic instead of sync/atomic" errcheck: exclude: scripts/errcheck_excludes.txt