errcheck: allow exclude config without extra file (#2110)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
Robert Liebowitz 2021-07-12 20:23:12 -04:00 committed by GitHub
parent f285d2c570
commit b3f9763246
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 4 deletions

View file

@ -161,10 +161,13 @@ type DuplSettings struct {
}
type ErrcheckSettings struct {
CheckTypeAssertions bool `mapstructure:"check-type-assertions"`
CheckAssignToBlank bool `mapstructure:"check-blank"`
Ignore string `mapstructure:"ignore"`
Exclude string `mapstructure:"exclude"`
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"`
}
type ErrorLintSettings struct {

View file

@ -152,6 +152,8 @@ func getChecker(errCfg *config.ErrcheckSettings) (*errcheck.Checker, error) {
checker.Exclusions.Symbols = append(checker.Exclusions.Symbols, exclude...)
}
checker.Exclusions.Symbols = append(checker.Exclusions.Symbols, errCfg.ExcludeFunctions...)
return &checker, nil
}