Skip to content
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
5 changes: 2 additions & 3 deletions pkg/goanalysis/runner_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ func (act *action) analyzeSafe() {
act.a.Name, act.pkg.Name, act.isInitialPkg, act.needAnalyzeSource, p), debug.Stack())
}
}()
act.r.sw.TrackStage(act.a.Name, func() {
act.analyze()
})

act.r.sw.TrackStage(act.a.Name, act.analyze)
}

func (act *action) analyze() {
Expand Down
28 changes: 12 additions & 16 deletions pkg/lint/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ func (r *Runner) Run(ctx context.Context, linters []*linter.Config) ([]result.Is
)

for _, lc := range linters {
sw.TrackStage(lc.Name(), func() {
linterIssues, err := r.runLinterSafe(ctx, r.lintCtx, lc)
if err != nil {
lintErrors = errors.Join(lintErrors, fmt.Errorf("can't run linter %s", lc.Linter.Name()), err)
r.Log.Warnf("Can't run linter %s: %v", lc.Linter.Name(), err)
linterIssues, err := timeutils.TrackStage(sw, lc.Name(), func() ([]result.Issue, error) {
return r.runLinterSafe(ctx, r.lintCtx, lc)
})
if err != nil {
lintErrors = errors.Join(lintErrors, fmt.Errorf("can't run linter %s", lc.Linter.Name()), err)
r.Log.Warnf("Can't run linter %s: %v", lc.Linter.Name(), err)

return
}
continue
}

issues = append(issues, linterIssues...)
})
issues = append(issues, linterIssues...)
}

return r.processLintResults(issues), lintErrors
Expand Down Expand Up @@ -188,9 +188,7 @@ func (r *Runner) processLintResults(inIssues []result.Issue) []result.Issue {
// finalize processors: logging, clearing, no heavy work here

for _, p := range r.Processors {
sw.TrackStage(p.Name(), func() {
p.Finish()
})
sw.TrackStage(p.Name(), p.Finish)
}

if issuesBefore != issuesAfter {
Expand All @@ -216,10 +214,8 @@ func (r *Runner) printPerProcessorStat(stat map[string]processorStat) {

func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, statPerProcessor map[string]processorStat) []result.Issue {
for _, p := range r.Processors {
var newIssues []result.Issue
var err error
sw.TrackStage(p.Name(), func() {
newIssues, err = p.Process(issues)
newIssues, err := timeutils.TrackStage(sw, p.Name(), func() ([]result.Issue, error) {
return p.Process(issues)
})

if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions pkg/result/processors/fixer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ func (p Fixer) Process(issues []result.Issue) ([]result.Issue, error) {
}

for file, issuesToFix := range issuesToFixPerFile {
var err error
p.sw.TrackStage("all", func() {
err = p.fixIssuesInFile(file, issuesToFix)
err := p.sw.TrackStageErr("all", func() error {
return p.fixIssuesInFile(file, issuesToFix)
})
if err != nil {
p.log.Errorf("Failed to fix issues in file %s: %s", file, err)
Expand Down
Loading