Skip to content

Commit

Permalink
dev: deprecate errcheck.ignore option
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed May 8, 2024
1 parent e89b55c commit f104e17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ issues:
- path: pkg/golinters/errcheck/errcheck.go
linters: [staticcheck]
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
- path: pkg/golinters/errcheck/errcheck.go
linters: [staticcheck]
text: "SA1019: errCfg.Ignore is deprecated: use ExcludeFunctions instead"
- path: pkg/golinters/govet/govet.go
linters: [staticcheck]
text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable."
Expand Down
4 changes: 3 additions & 1 deletion pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,13 @@ type ErrcheckSettings struct {
DisableDefaultExclusions bool `mapstructure:"disable-default-exclusions"`
CheckTypeAssertions bool `mapstructure:"check-type-assertions"`
CheckAssignToBlank bool `mapstructure:"check-blank"`
Ignore string `mapstructure:"ignore"`
ExcludeFunctions []string `mapstructure:"exclude-functions"`

// Deprecated: use ExcludeFunctions instead
Exclude string `mapstructure:"exclude"`

// Deprecated: use ExcludeFunctions instead
Ignore string `mapstructure:"ignore"`
}

type ErrChkJSONSettings struct {
Expand Down
7 changes: 7 additions & 0 deletions pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ func (l *Loader) handleDeprecation() error {
return nil
}

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

// Deprecated since v1.59.0,
// but it was unofficially deprecated since v1.13 (2018) (https://github.com/golangci/golangci-lint/pull/332).
if l.cfg.LintersSettings.Errcheck.Ignore != "" {
l.log.Warnf("The configuration option `linters.errcheck.ignore` is deprecated, please use `linters.errcheck.exclude-functions`.")
}

// Deprecated since v1.44.0.
if l.cfg.LintersSettings.Gci.LocalPrefixes != "" {
l.log.Warnf("The configuration option `linters.gci.local-prefixes` is deprecated, please use `prefix()` inside `linters.gci.sections`.")
Expand Down

0 comments on commit f104e17

Please sign in to comment.