Skip to content

Commit

Permalink
fix: #50
Browse files Browse the repository at this point in the history
  • Loading branch information
triarius committed Aug 15, 2023
1 parent 66081af commit 0d4020f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions errorlint/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ func LintErrorTypeAssertions(fset *token.FileSet, info *TypesInfoExt) []analysis
continue
}

if isNodeInErrorIsFunc(info, typeAssert) {
continue
}

lints = append(lints, analysis.Diagnostic{
Message: "type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors",
Pos: typeAssert.Pos(),
Expand Down Expand Up @@ -330,6 +334,10 @@ func LintErrorTypeAssertions(fset *token.FileSet, info *TypesInfoExt) []analysis
continue
}

if isNodeInErrorIsFunc(info, typeSwitch) {
continue
}

lints = append(lints, analysis.Diagnostic{
Message: "type switch on error will fail on wrapped errors. Use errors.As to check for specific errors",
Pos: typeAssert.Pos(),
Expand Down

0 comments on commit 0d4020f

Please sign in to comment.