From 5208a9b55d38912eb68a4d9df4ddc551b0529e31 Mon Sep 17 00:00:00 2001 From: Marat Reymers Date: Fri, 27 May 2022 19:36:23 +0300 Subject: [PATCH 1/2] docs: linters-settings: depguard: add missing `ignore-file-rules` --- .golangci.reference.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 131458efa9f9..84aee96ea7e4 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -163,9 +163,11 @@ linters-settings: include-go-root: true # A list of packages for the list type specified. + # Can accept both string prefixes and string glob patterns. # Default: [] packages: - github.com/sirupsen/logrus + - allow/**/pkg # A list of packages for the list type specified. # Specify an error message to output when a denied package is used. @@ -173,6 +175,15 @@ linters-settings: packages-with-error-message: - github.com/sirupsen/logrus: 'logging is allowed only by logutils.Log' + # Specify rules by which the linter ignores certain files for consideration. + # Can accept both string prefixes and string glob patterns. + # The ! character in front of the rule is a special character + # which signals that the linter should negate the rule. + # This allows for more precise control, but it is only available for glob patterns. + # Default: [] + ignore-file-rules: + - "!**/*_test.go" + # Create additional guards that follow the same configuration pattern. # Results from all guards are aggregated together. additional-guards: From f72b102b23def07426d321b6d20c46ef5d6d5a5f Mon Sep 17 00:00:00 2001 From: Marat Reymers Date: Sat, 28 May 2022 22:46:36 +0300 Subject: [PATCH 2/2] Add an example without ! --- .golangci.reference.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 84aee96ea7e4..253716f17117 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -182,6 +182,7 @@ linters-settings: # This allows for more precise control, but it is only available for glob patterns. # Default: [] ignore-file-rules: + - "ignore/**/*.go" - "!**/*_test.go" # Create additional guards that follow the same configuration pattern.