Skip to content

Commit 9c1c57b

Browse files
committed
chore: deprecate check-shadowing
1 parent 2bcc010 commit 9c1c57b

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-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.

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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ 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. Please enable `shadow` instead, if you are not using `enable-all`.")
329+
}
330+
325331
return nil
326332
}
327333

0 commit comments

Comments
 (0)