Skip to content

fix: deduplicate typecheck errors #5864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/goanalysis/pkgerrors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func (e *IllTypedError) Error() string {

func BuildIssuesFromIllTypedError(errs []error, lintCtx *linter.Context) ([]*result.Issue, error) {
var issues []*result.Issue

uniqReportedIssues := map[string]bool{}

var other error
Expand All @@ -39,9 +40,17 @@ func BuildIssuesFromIllTypedError(errs []error, lintCtx *linter.Context) ([]*res
if uniqReportedIssues[err.Msg] {
continue
}

uniqReportedIssues[err.Msg] = true
lintCtx.Log.Errorf("typechecking error: %s", err.Msg)
} else {
key := fmt.Sprintf("%s.%d.%d.%s", issue.FilePath(), issue.Line(), issue.Column(), issue.Text)
if uniqReportedIssues[key] {
continue
}

uniqReportedIssues[key] = true

issue.Pkg = ill.Pkg // to save to cache later
issues = append(issues, issue)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/lint/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (r *Runner) processIssues(issues []*result.Issue, sw *timeutils.Stopwatch,
})

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