From bace32a106189a402c240137299ca472d14b259a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 26 Feb 2023 12:53:43 +0000 Subject: [PATCH 1/2] build(deps): bump github.com/polyfloyd/go-errorlint from 1.1.0 to 1.2.0 Bumps [github.com/polyfloyd/go-errorlint](https://github.com/polyfloyd/go-errorlint) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/polyfloyd/go-errorlint/releases) - [Changelog](https://github.com/polyfloyd/go-errorlint/blob/main/CHANGELOG.md) - [Commits](https://github.com/polyfloyd/go-errorlint/compare/v1.1.0...v1.2.0) --- updated-dependencies: - dependency-name: github.com/polyfloyd/go-errorlint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c5078cfd7b09..475b3b186f6b 100644 --- a/go.mod +++ b/go.mod @@ -75,7 +75,7 @@ require ( github.com/nishanths/exhaustive v0.9.5 github.com/nishanths/predeclared v0.2.2 github.com/nunnatsa/ginkgolinter v0.8.1 - github.com/polyfloyd/go-errorlint v1.1.0 + github.com/polyfloyd/go-errorlint v1.2.0 github.com/quasilyte/go-ruleguard/dsl v0.3.22 github.com/ryancurrah/gomodguard v1.3.0 github.com/ryanrolds/sqlclosecheck v0.4.0 diff --git a/go.sum b/go.sum index 0c337e8fdbda..d5264553acdd 100644 --- a/go.sum +++ b/go.sum @@ -412,8 +412,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.1.0 h1:VKoEFg5yxSgJ2yFPVhxW7oGz+f8/OVcuMeNvcPIi6Eg= -github.com/polyfloyd/go-errorlint v1.1.0/go.mod h1:Uss7Bc/izYG0leCMRx3WVlrpqWedSZk7V/FUQW6VJ6U= +github.com/polyfloyd/go-errorlint v1.2.0 h1:d+f5Xh4ppX2ndg0DzkjXqqd127NgDb/SyRgYTisCHAQ= +github.com/polyfloyd/go-errorlint v1.2.0/go.mod h1:Uss7Bc/izYG0leCMRx3WVlrpqWedSZk7V/FUQW6VJ6U= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= From 2c8d1e6de98eb81d91c2ba9f83b6063b1ee0c8b1 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 26 Feb 2023 14:41:16 +0100 Subject: [PATCH 2/2] review: add new option --- .golangci.reference.yml | 3 +++ pkg/config/linters_settings.go | 14 ++++++++------ pkg/golinters/errorlint.go | 7 ++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 7de210b98ba4..241fb7fe4df2 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -294,6 +294,9 @@ linters-settings: # See the https://github.com/polyfloyd/go-errorlint for caveats. # Default: true errorf: false + # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true) + # Default: true + errorf-multi: false # Check for plain type assertions and type switches. # Default: true asserts: false diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index d76eaaccfc99..fb805f020179 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -19,9 +19,10 @@ var defaultLintersSettings = LintersSettings{ MaxBlankIdentifiers: 2, }, ErrorLint: ErrorLintSettings{ - Errorf: true, - Asserts: true, - Comparison: true, + Errorf: true, + ErrorfMulti: true, + Asserts: true, + Comparison: true, }, Exhaustive: ExhaustiveSettings{ Check: []string{"switch"}, @@ -280,9 +281,10 @@ type ErrChkJSONSettings struct { } type ErrorLintSettings struct { - Errorf bool `mapstructure:"errorf"` - Asserts bool `mapstructure:"asserts"` - Comparison bool `mapstructure:"comparison"` + Errorf bool `mapstructure:"errorf"` + ErrorfMulti bool `mapstructure:"errorf-multi"` + Asserts bool `mapstructure:"asserts"` + Comparison bool `mapstructure:"comparison"` } type ExhaustiveSettings struct { diff --git a/pkg/golinters/errorlint.go b/pkg/golinters/errorlint.go index dd9d901617a9..36c976a5b7e8 100644 --- a/pkg/golinters/errorlint.go +++ b/pkg/golinters/errorlint.go @@ -15,9 +15,10 @@ func NewErrorLint(cfg *config.ErrorLintSettings) *goanalysis.Linter { if cfg != nil { cfgMap[a.Name] = map[string]interface{}{ - "errorf": cfg.Errorf, - "asserts": cfg.Asserts, - "comparison": cfg.Comparison, + "errorf": cfg.Errorf, + "errorf-multi": cfg.ErrorfMulti, + "asserts": cfg.Asserts, + "comparison": cfg.Comparison, } }