From 5dc8374f9e7b2b1a46b339cf01b50d8b8e9c388d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 12 Nov 2023 11:19:42 +0000 Subject: [PATCH 1/2] build(deps): bump github.com/nishanths/exhaustive from 0.11.0 to 0.12.0 Bumps [github.com/nishanths/exhaustive](https://github.com/nishanths/exhaustive) from 0.11.0 to 0.12.0. - [Commits](https://github.com/nishanths/exhaustive/compare/v0.11.0...v0.12.0) --- updated-dependencies: - dependency-name: github.com/nishanths/exhaustive dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 6f1aed22157a..cef185884dc1 100644 --- a/go.mod +++ b/go.mod @@ -80,7 +80,7 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/moricho/tparallel v0.3.1 github.com/nakabonne/nestif v0.3.1 - github.com/nishanths/exhaustive v0.11.0 + github.com/nishanths/exhaustive v0.12.0 github.com/nishanths/predeclared v0.2.2 github.com/nunnatsa/ginkgolinter v0.14.1 github.com/polyfloyd/go-errorlint v1.4.5 @@ -123,7 +123,7 @@ require ( go-simpler.org/sloglint v0.3.0 go.tmz.dev/musttag v0.7.2 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.14.0 + golang.org/x/tools v0.15.0 gopkg.in/yaml.v3 v3.0.1 honnef.co/go/tools v0.4.6 mvdan.cc/gofumpt v0.5.0 @@ -192,7 +192,7 @@ require ( go.uber.org/zap v1.24.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/sync v0.4.0 // indirect + golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/protobuf v1.28.0 // indirect diff --git a/go.sum b/go.sum index 021501d83ddd..c7634c3b578a 100644 --- a/go.sum +++ b/go.sum @@ -401,8 +401,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= -github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= +github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhKRf3Swg= +github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/nunnatsa/ginkgolinter v0.14.1 h1:khx0CqR5U4ghsscjJ+lZVthp3zjIFytRXPTaQ/TMiyA= @@ -708,7 +708,7 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -732,8 +732,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -890,8 +890,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From bccd7868953210df7ea4c6dde34cb295dcf9c1f6 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 12 Nov 2023 13:02:25 +0100 Subject: [PATCH 2/2] chore: update implementation --- .golangci.reference.yml | 3 +++ pkg/config/linters_settings.go | 1 + pkg/golinters/exhaustive.go | 1 + 3 files changed, 5 insertions(+) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index f6df26a421b2..81d342e7dc9d 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -344,6 +344,9 @@ linters-settings: # Only run exhaustive check on map literals with "//exhaustive:enforce" comment. # Default: false explicit-exhaustive-map: true + # Switch statement requires default case even if exhaustive. + # Default: false + default-case-required: true exhaustivestruct: # Struct Patterns is list of expressions to match struct packages and names. diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index cefd33a926cd..f6687db8178b 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -352,6 +352,7 @@ type ExhaustiveSettings struct { PackageScopeOnly bool `mapstructure:"package-scope-only"` ExplicitExhaustiveMap bool `mapstructure:"explicit-exhaustive-map"` ExplicitExhaustiveSwitch bool `mapstructure:"explicit-exhaustive-switch"` + DefaultCaseRequired bool `mapstructure:"default-case-required"` } type ExhaustiveStructSettings struct { diff --git a/pkg/golinters/exhaustive.go b/pkg/golinters/exhaustive.go index 3824afa0b9d1..fe58e10f0570 100644 --- a/pkg/golinters/exhaustive.go +++ b/pkg/golinters/exhaustive.go @@ -23,6 +23,7 @@ func NewExhaustive(settings *config.ExhaustiveSettings) *goanalysis.Linter { exhaustive.PackageScopeOnlyFlag: settings.PackageScopeOnly, exhaustive.ExplicitExhaustiveMapFlag: settings.ExplicitExhaustiveMap, exhaustive.ExplicitExhaustiveSwitchFlag: settings.ExplicitExhaustiveSwitch, + exhaustive.DefaultCaseRequiredFlag: settings.DefaultCaseRequired, }, } }