Skip to content

Commit 0e51694

Browse files
Gustedlunnydelvhtechknowlogick
authored
Fix inconsistency in doctor output (#19836)
* Fix inconsistency in doctor output - Use `logger.Info` instead of `logger.Warn` when no errors were found. * Update modules/doctor/fix16961.go Co-authored-by: delvh <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: delvh <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 40e87d0 commit 0e51694

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

modules/doctor/fix16961.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,11 @@ func fixBrokenRepoUnits16961(ctx context.Context, logger log.Logger, autofix boo
302302
}
303303

304304
if !autofix {
305-
logger.Warn("Found %d broken repo_units", count)
305+
if count == 0 {
306+
logger.Info("Found no broken repo_units")
307+
} else {
308+
logger.Warn("Found %d broken repo_units", count)
309+
}
306310
return nil
307311
}
308312
logger.Info("Fixed %d broken repo_units", count)

modules/doctor/mergebase.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ func checkPRMergeBase(ctx context.Context, logger log.Logger, autofix bool) erro
9292
if autofix {
9393
logger.Info("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
9494
} else {
95-
if numPRsUpdated > 0 && err == nil {
95+
if numPRsUpdated == 0 {
96+
logger.Info("All %d PRs in %d repos have a correct mergebase", numPRs, numRepos)
97+
} else if err == nil {
9698
logger.Critical("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
9799
return fmt.Errorf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
100+
} else {
101+
logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
98102
}
99-
100-
logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
101103
}
102104

103105
return err

0 commit comments

Comments
 (0)