diff --git a/.golangci.yml b/.golangci.yml index eeb20a6adaa2..6ce7811bac11 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -59,13 +59,6 @@ linters-settings: gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true - depguard: - # disallow packages from being used - list-type: blacklist - packages: - - github.com/boltdb/bolt - - github.com/hashicorp/consul/command/flags - - github.com/pkg/errors gocritic: disabled-checks: - commentFormatting @@ -92,7 +85,6 @@ linters: - unconvert - gofmt - gosimple - - depguard - staticcheck - asasalint - asciicheck diff --git a/.semgrep/imports.yml b/.semgrep/imports.yml new file mode 100644 index 000000000000..3afb901dd621 --- /dev/null +++ b/.semgrep/imports.yml @@ -0,0 +1,18 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +rules: + - id: "disallow-imports" + patterns: + - pattern: '"github.com/boltdb/bolt"' + - pattern: '"github.com/pkg/errors"' + - pattern: '"github.com/hashicorp/consul"' + - pattern: '"github.com/hashicorp/consul/command/flags"' + - pattern: '"github.com/hashicorp/consul/sdk"' + message: "Import of this package has been disallowed" + languages: + - "generic" + severity: "ERROR" + paths: + include: + - "*.go"