From 43114231ef6927658572fb3494021a4aef9d50ef Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Wed, 9 Aug 2023 20:26:12 +0000 Subject: [PATCH] build: swap depguard for semgrep --- .golangci.yml | 8 -------- .semgrep/imports.yml | 18 ++++++++++++++++++ GNUmakefile | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .semgrep/imports.yml diff --git a/.golangci.yml b/.golangci.yml index eeb20a6adaa..6ce7811bac1 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 00000000000..3afb901dd62 --- /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" diff --git a/GNUmakefile b/GNUmakefile index 499b25f4ea9..c8c59df7fa2 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -143,7 +143,7 @@ deps: ## Install build and development dependencies .PHONY: lint-deps lint-deps: ## Install linter dependencies @echo "==> Updating linter dependencies..." - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.0 go install github.com/client9/misspell/cmd/misspell@v0.3.4 go install github.com/hashicorp/go-hclog/hclogvet@v0.1.6