Skip to content

Commit 6a786c9

Browse files
committed
dev: deprecate errcheck.ignore option
1 parent dc28153 commit 6a786c9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.golangci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ issues:
167167
- path: pkg/golinters/errcheck/errcheck.go
168168
linters: [staticcheck]
169169
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
170+
- path: pkg/golinters/errcheck/errcheck.go
171+
linters: [staticcheck]
172+
text: "SA1019: errCfg.Ignore is deprecated: use ExcludeFunctions instead"
170173
- path: pkg/golinters/govet/govet.go
171174
linters: [staticcheck]
172175
text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable."

pkg/config/linters_settings.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,13 @@ type ErrcheckSettings struct {
371371
DisableDefaultExclusions bool `mapstructure:"disable-default-exclusions"`
372372
CheckTypeAssertions bool `mapstructure:"check-type-assertions"`
373373
CheckAssignToBlank bool `mapstructure:"check-blank"`
374-
Ignore string `mapstructure:"ignore"`
375374
ExcludeFunctions []string `mapstructure:"exclude-functions"`
376375

377376
// Deprecated: use ExcludeFunctions instead
378377
Exclude string `mapstructure:"exclude"`
378+
379+
// Deprecated: use ExcludeFunctions instead
380+
Ignore string `mapstructure:"ignore"`
379381
}
380382

381383
type ErrChkJSONSettings struct {

pkg/config/loader.go

+7
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ func (l *Loader) handleDeprecation() error {
355355
return nil
356356
}
357357

358+
//nolint:gocyclo // the complexity cannot be reduced.
358359
func (l *Loader) handleLinterOptionDeprecations() {
359360
// Deprecated since v1.57.0,
360361
// but it was unofficially deprecated since v1.19 (2019) (https://github.com/golangci/golangci-lint/pull/697).
@@ -373,6 +374,12 @@ func (l *Loader) handleLinterOptionDeprecations() {
373374
l.log.Warnf("The configuration option `linters.errcheck.exclude` is deprecated, please use `linters.errcheck.exclude-functions`.")
374375
}
375376

377+
// Deprecated since v1.59.0,
378+
// but it was unofficially deprecated since v1.13 (2018) (https://github.com/golangci/golangci-lint/pull/332).
379+
if l.cfg.LintersSettings.Errcheck.Ignore != "" {
380+
l.log.Warnf("The configuration option `linters.errcheck.ignore` is deprecated, please use `linters.errcheck.exclude-functions`.")
381+
}
382+
376383
// Deprecated since v1.44.0.
377384
if l.cfg.LintersSettings.Gci.LocalPrefixes != "" {
378385
l.log.Warnf("The configuration option `linters.gci.local-prefixes` is deprecated, please use `prefix()` inside `linters.gci.sections`.")

0 commit comments

Comments
 (0)