diff --git a/.golangci.next.reference.yml b/.golangci.next.reference.yml index 81d741134a69..548166540f4c 100644 --- a/.golangci.next.reference.yml +++ b/.golangci.next.reference.yml @@ -3758,6 +3758,9 @@ linters: # Default: [] ignore-interface-regexps: - ^(?i)c(?-i)ach(ing|e) + # Determines whether wrapcheck should report errors returned from inside the package. + # Default: false + report-internal-errors: true wsl: # Do strict checking when assigning from append (x = append(x, y)). diff --git a/go.mod b/go.mod index 423c12939046..970e5a2f9294 100644 --- a/go.mod +++ b/go.mod @@ -111,7 +111,7 @@ require ( github.com/tetafro/godot v1.5.0 github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 github.com/timonwong/loggercheck v0.10.1 - github.com/tomarrell/wrapcheck/v2 v2.10.0 + github.com/tomarrell/wrapcheck/v2 v2.11.0 github.com/tommy-muehle/go-mnd/v2 v2.5.1 github.com/ultraware/funlen v0.2.0 github.com/ultraware/whitespace v0.2.0 diff --git a/go.sum b/go.sum index 3d633f4b3ffa..f3d3371ad890 100644 --- a/go.sum +++ b/go.sum @@ -583,8 +583,8 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/tomarrell/wrapcheck/v2 v2.10.0 h1:SzRCryzy4IrAH7bVGG4cK40tNUhmVmMDuJujy4XwYDg= -github.com/tomarrell/wrapcheck/v2 v2.10.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= +github.com/tomarrell/wrapcheck/v2 v2.11.0 h1:BJSt36snX9+4WTIXeJ7nvHBQBcm1h2SjQMSlmQ6aFSU= +github.com/tomarrell/wrapcheck/v2 v2.11.0/go.mod h1:wFL9pDWDAbXhhPZZt+nG8Fu+h29TtnZ2MW6Lx4BRXIU= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ultraware/funlen v0.2.0 h1:gCHmCn+d2/1SemTdYMiKLAHFYxTYz7z9VIDRaTGyLkI= diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json index 776a489afd98..e768900991ca 100644 --- a/jsonschema/golangci.next.jsonschema.json +++ b/jsonschema/golangci.next.jsonschema.json @@ -3934,6 +3934,11 @@ "items": { "type": "string" } + }, + "report-internal-errors": { + "description": "Determines whether wrapcheck should report errors returned from inside the package.", + "type": "boolean", + "default": false } } }, diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 86ee4fea48d2..45109fe4b088 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -965,6 +965,7 @@ type WrapcheckSettings struct { IgnoreSigRegexps []string `mapstructure:"ignore-sig-regexps"` IgnorePackageGlobs []string `mapstructure:"ignore-package-globs"` IgnoreInterfaceRegexps []string `mapstructure:"ignore-interface-regexps"` + ReportInternalErrors bool `mapstructure:"report-internal-errors"` } type WSLSettings struct { diff --git a/pkg/golinters/wrapcheck/wrapcheck.go b/pkg/golinters/wrapcheck/wrapcheck.go index 8918a82eaf1a..8a4427f7d368 100644 --- a/pkg/golinters/wrapcheck/wrapcheck.go +++ b/pkg/golinters/wrapcheck/wrapcheck.go @@ -10,8 +10,10 @@ import ( func New(settings *config.WrapcheckSettings) *goanalysis.Linter { cfg := wrapcheck.NewDefaultConfig() + if settings != nil { cfg.ExtraIgnoreSigs = settings.ExtraIgnoreSigs + cfg.ReportInternalErrors = settings.ReportInternalErrors if len(settings.IgnoreSigs) != 0 { cfg.IgnoreSigs = settings.IgnoreSigs