Skip to content

Commit

Permalink
feat: skip soft errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Mar 23, 2021
1 parent a52604b commit d451c22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/golinters/goanalysis/runner_loadingpackage.go
Expand Up @@ -390,6 +390,7 @@ func (lp *loadingPackage) decUse(canClearTypes bool) {

func (lp *loadingPackage) convertError(err error) []packages.Error {
var errs []packages.Error

// taken from go/packages
switch err := err.(type) {
case packages.Error:
Expand All @@ -416,6 +417,12 @@ func (lp *loadingPackage) convertError(err error) []packages.Error {

case types.Error:
// from type checker
if err.Soft {
// The meaning of soft is explained in types.Error godoc.
// We skip this kind of error because they are handle by the other linters.
return nil
}

errs = append(errs, packages.Error{
Pos: err.Fset.Position(err.Pos).String(),
Msg: err.Msg,
Expand All @@ -433,6 +440,7 @@ func (lp *loadingPackage) convertError(err error) []packages.Error {
// If you see this error message, please file a bug.
lp.log.Warnf("Internal error: error %q (%T) without position", err, err)
}

return errs
}

Expand Down

0 comments on commit d451c22

Please sign in to comment.