From 8d563695949b34faf917d32656ade441a143baa5 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sun, 29 May 2022 12:26:50 +0200 Subject: [PATCH 1/2] Fix inconsistency in doctor output - Use `logger.Info` instead of `logger.Warn` when no errors were found. --- modules/doctor/fix16961.go | 5 +++++ modules/doctor/mergebase.go | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/doctor/fix16961.go b/modules/doctor/fix16961.go index 92c77ba80f291..3183b150295a9 100644 --- a/modules/doctor/fix16961.go +++ b/modules/doctor/fix16961.go @@ -302,6 +302,11 @@ func fixBrokenRepoUnits16961(ctx context.Context, logger log.Logger, autofix boo } if !autofix { + if count == 0 { + logger.Info("Foud no broken repo_units") + return nil + } + logger.Warn("Found %d broken repo_units", count) return nil } diff --git a/modules/doctor/mergebase.go b/modules/doctor/mergebase.go index 8f5c61a5dab2d..61ee9e212bd1d 100644 --- a/modules/doctor/mergebase.go +++ b/modules/doctor/mergebase.go @@ -92,12 +92,14 @@ func checkPRMergeBase(ctx context.Context, logger log.Logger, autofix bool) erro if autofix { logger.Info("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) } else { - if numPRsUpdated > 0 && err == nil { + if numPRsUpdated == 0 { + logger.Info("All %d PRs in %d repos have a correct mergebase", numPRs, numRepos) + } else if err == nil { logger.Critical("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) return fmt.Errorf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) + } else { + logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) } - - logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) } return err From a3c093b290c15eac6373aa8dd7dbe809297686cc Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 31 May 2022 19:59:54 +0800 Subject: [PATCH 2/2] Update modules/doctor/fix16961.go Co-authored-by: delvh --- modules/doctor/fix16961.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/doctor/fix16961.go b/modules/doctor/fix16961.go index 3183b150295a9..92c44185055e1 100644 --- a/modules/doctor/fix16961.go +++ b/modules/doctor/fix16961.go @@ -303,11 +303,10 @@ func fixBrokenRepoUnits16961(ctx context.Context, logger log.Logger, autofix boo if !autofix { if count == 0 { - logger.Info("Foud no broken repo_units") - return nil + logger.Info("Found no broken repo_units") + } else { + logger.Warn("Found %d broken repo_units", count) } - - logger.Warn("Found %d broken repo_units", count) return nil } logger.Info("Fixed %d broken repo_units", count)