From e13f4427084b7aad148a2a69fcab59110a7ef318 Mon Sep 17 00:00:00 2001 From: Narthana Epa Date: Wed, 2 Aug 2023 22:36:13 +1000 Subject: [PATCH] fix: #50 --- errorlint/lint.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/errorlint/lint.go b/errorlint/lint.go index 52a0e10..817cd69 100644 --- a/errorlint/lint.go +++ b/errorlint/lint.go @@ -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(), @@ -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(),