Skip to content

Commit 65c85df

Browse files
authored
fix: deduplicate typecheck errors (#5864)
1 parent a25cd63 commit 65c85df

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/goanalysis/pkgerrors/errors.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func (e *IllTypedError) Error() string {
2020

2121
func BuildIssuesFromIllTypedError(errs []error, lintCtx *linter.Context) ([]*result.Issue, error) {
2222
var issues []*result.Issue
23+
2324
uniqReportedIssues := map[string]bool{}
2425

2526
var other error
@@ -39,9 +40,17 @@ func BuildIssuesFromIllTypedError(errs []error, lintCtx *linter.Context) ([]*res
3940
if uniqReportedIssues[err.Msg] {
4041
continue
4142
}
43+
4244
uniqReportedIssues[err.Msg] = true
4345
lintCtx.Log.Errorf("typechecking error: %s", err.Msg)
4446
} else {
47+
key := fmt.Sprintf("%s.%d.%d.%s", issue.FilePath(), issue.Line(), issue.Column(), issue.Text)
48+
if uniqReportedIssues[key] {
49+
continue
50+
}
51+
52+
uniqReportedIssues[key] = true
53+
4554
issue.Pkg = ill.Pkg // to save to cache later
4655
issues = append(issues, issue)
4756
}

pkg/lint/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (r *Runner) processIssues(issues []*result.Issue, sw *timeutils.Stopwatch,
232232
})
233233

234234
if err != nil {
235-
r.Log.Warnf("Can't process result by %s processor: %s", p.Name(), err)
235+
r.Log.Warnf("Can't process results by %s processor: %s", p.Name(), err)
236236
} else {
237237
stat := statPerProcessor[p.Name()]
238238
stat.inCount += len(issues)

0 commit comments

Comments
 (0)