From ee5257d5d73f105f5c06e73a131f05f6902dc65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szulik?= Date: Thu, 14 Dec 2023 10:56:34 +0100 Subject: [PATCH] DEVOPS-6856 Add depguard config (#76) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Szulik --- go/lint/.golangci.yml | 18 ++++++++++++++++++ go/lint/action.yaml | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/go/lint/.golangci.yml b/go/lint/.golangci.yml index 048ab20..0841b7e 100644 --- a/go/lint/.golangci.yml +++ b/go/lint/.golangci.yml @@ -11,6 +11,23 @@ linters-settings: lll: line-length: 120 + depguard: + rules: + Main: + list-mode: lax + files: + - $all + - "!$test" + deny: + - pkg: reflect + desc: Please don't use reflect package + Test: + list-mode: lax + files: + - $test + deny: + - pkg: reflect + desc: Please don't use reflect package linters: disable-all: true @@ -29,6 +46,7 @@ linters: - gofmt - gocognit - dupl + - depguard - whitespace - goconst - unconvert diff --git a/go/lint/action.yaml b/go/lint/action.yaml index 324e742..e624609 100644 --- a/go/lint/action.yaml +++ b/go/lint/action.yaml @@ -73,7 +73,7 @@ runs: with: version: ${{ inputs.golangci-lint-version }} # Extended timeout to ensure all the linters are installed before it hits - args: --concurrency ${{ inputs.golangci-lint-concurrency }} --exclude-use-default=false --timeout=${{ inputs.golangci-lint-timeout }} + args: --concurrency ${{ inputs.golangci-lint-concurrency }} --exclude-use-default=false --timeout=${{ inputs.golangci-lint-timeout }} -c ${{ github.action_path }}/.golangci.yml - name: Run linters (with incremental improvements) if: ${{ inputs.inclint == 'true' }}