Skip to content

Commit 3c67e40

Browse files
committed
chore: deprecate check-shadowing
1 parent 2bcc010 commit 3c67e40

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

.golangci.next.reference.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,10 +1074,6 @@ linters-settings:
10741074
- Katakana
10751075

10761076
govet:
1077-
# Report about shadowed variables.
1078-
# Default: false
1079-
check-shadowing: true
1080-
10811077
# Settings per analyzer.
10821078
settings:
10831079
# Analyzer name, run `go tool vet help` to see all analyzers.

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ issues:
155155
- path: pkg/commands/run.go
156156
linters: [staticcheck]
157157
text: "SA1019: c.cfg.Run.ShowStats is deprecated: use Output.ShowStats instead."
158+
- path: pkg/golinters/govet.go
159+
text: "SA1019: settings.CheckShadowing is deprecated: the linter should be enabled inside `Enable`."
158160

159161
- path: pkg/golinters/gofumpt.go
160162
linters: [staticcheck]

jsonschema/golangci.next.jsonschema.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,11 +1661,6 @@
16611661
"type": "object",
16621662
"additionalProperties": false,
16631663
"properties": {
1664-
"check-shadowing": {
1665-
"description": "Report shadowed variables.",
1666-
"type": "boolean",
1667-
"default": true
1668-
},
16691664
"settings": {
16701665
"description": "Settings per analyzer. Map of analyzer name to specific settings.\nRun `go tool vet help` to find out more.",
16711666
"type": "object",

pkg/config/linters_settings.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,14 +598,16 @@ type GosmopolitanSettings struct {
598598
}
599599

600600
type GovetSettings struct {
601-
Go string `mapstructure:"-"`
602-
CheckShadowing bool `mapstructure:"check-shadowing"`
603-
Settings map[string]map[string]any
601+
Go string `mapstructure:"-"`
602+
Settings map[string]map[string]any
604603

605604
Enable []string
606605
Disable []string
607606
EnableAll bool `mapstructure:"enable-all"`
608607
DisableAll bool `mapstructure:"disable-all"`
608+
609+
// Deprecated: the linter should be enabled inside `Enable`.
610+
CheckShadowing bool `mapstructure:"check-shadowing"`
609611
}
610612

611613
func (cfg *GovetSettings) Validate() error {

pkg/config/loader.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,13 @@ func (l *Loader) handleDeprecation() error {
322322
l.cfg.Output.Formats = f
323323
}
324324

325+
// Deprecated since v1.57.0,
326+
// but it was unofficially deprecated since v1.19 (2019) (https://github.com/golangci/golangci-lint/pull/697).
327+
if l.cfg.LintersSettings.Govet.CheckShadowing {
328+
l.warn("The configuration option `govet.check-shadowing` is deprecated. " +
329+
"Please enable `shadow` instead, if you are not using `enable-all`.")
330+
}
331+
325332
return nil
326333
}
327334

0 commit comments

Comments
 (0)