diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 878597c38f45..5476b5ad8563 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -205,6 +205,10 @@ linters-settings: rules: # Name of a rule. main: + # Used to determine the package matching priority. + # There are three different modes: `original`, `strict`, and `lax`. + # Default: "original" + list-mode: lax # List of file globs that will match this list of settings to compare against. # Default: $all files: diff --git a/go.mod b/go.mod index 66c1dd461952..f5c36b856a29 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/BurntSushi/toml v1.3.2 github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 - github.com/OpenPeeDeeP/depguard/v2 v2.1.0 + github.com/OpenPeeDeeP/depguard/v2 v2.2.0 github.com/alecthomas/go-check-sumtype v0.1.3 github.com/alexkohler/nakedret/v2 v2.0.2 github.com/alexkohler/prealloc v1.0.0 diff --git a/go.sum b/go.sum index a2ed22f700b1..a95d3e50d156 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,8 @@ github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 h1:3ZBs7LAezy8gh0uECsA6C github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0/go.mod h1:rZLTje5A9kFBe0pzhpe2TdhRniBF++PRHQuRpR8esVc= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= -github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= +github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= +github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/go-check-sumtype v0.1.3 h1:M+tqMxB68hcgccRXBMVCPI4UJ+QUfdSx0xdbypKCqA8= github.com/alecthomas/go-check-sumtype v0.1.3/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 5f85059b5873..c75e7978e391 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -289,9 +289,10 @@ type DepGuardSettings struct { } type DepGuardList struct { - Files []string `mapstructure:"files"` - Allow []string `mapstructure:"allow"` - Deny []DepGuardDeny `mapstructure:"deny"` + ListMode string `mapstructure:"list-mode"` + Files []string `mapstructure:"files"` + Allow []string `mapstructure:"allow"` + Deny []DepGuardDeny `mapstructure:"deny"` } type DepGuardDeny struct { diff --git a/pkg/golinters/depguard.go b/pkg/golinters/depguard.go index 23986708c931..49e471df824d 100644 --- a/pkg/golinters/depguard.go +++ b/pkg/golinters/depguard.go @@ -15,8 +15,9 @@ func NewDepguard(settings *config.DepGuardSettings) *goanalysis.Linter { if settings != nil { for s, rule := range settings.Rules { list := &depguard.List{ - Files: rule.Files, - Allow: rule.Allow, + ListMode: rule.ListMode, + Files: rule.Files, + Allow: rule.Allow, } // because of bug with Viper parsing (split on dot) we use a list of struct instead of a map.