Skip to content

Commit b9a89c3

Browse files
committed
simplify code
1 parent b8059a0 commit b9a89c3

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

cmd/agent/main.go

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -562,17 +562,16 @@ func (a *Agent) processFailedReports(ctx context.Context) {
562562
case <-ctx.Done():
563563
return
564564
case <-ticker.C:
565-
// Process all queued reports
565+
// Drain all queued reports
566566
for {
567567
select {
568568
case report := <-a.failedReports:
569569
a.retryFailedReport(ctx, report)
570570
default:
571-
// No more reports to process
572-
goto nextTick
571+
goto drained
573572
}
574573
}
575-
nextTick:
574+
drained:
576575
}
577576
}
578577
}
@@ -1394,19 +1393,6 @@ func (*Agent) displayFailedChecks(results map[string]CheckResult, finalOrder []s
13941393
}
13951394
}
13961395

1397-
// displayAllChecks shows all checks in verbose mode.
1398-
// getStatusDisplay returns the icon and color text for a status.
1399-
func getStatusDisplay(status string) (icon, color string) {
1400-
switch status {
1401-
case statusPass:
1402-
return "✅", "PASS"
1403-
case statusFail:
1404-
return "❌", "FAIL"
1405-
default:
1406-
return "➖", "N/A"
1407-
}
1408-
}
1409-
14101396
// displayCommandOutput displays a single command output.
14111397
func displayCommandOutput(output gitmdm.CommandOutput, index, total int) {
14121398
// Show command number if multiple
@@ -1510,7 +1496,15 @@ func (*Agent) displayAllChecks(results map[string]CheckResult, checkOrder []stri
15101496
}
15111497

15121498
// Display check header inline
1513-
statusIcon, statusColor := getStatusDisplay(result.Status)
1499+
var statusIcon, statusColor string
1500+
switch result.Status {
1501+
case statusPass:
1502+
statusIcon, statusColor = "✅", "PASS"
1503+
case statusFail:
1504+
statusIcon, statusColor = "❌", "FAIL"
1505+
default:
1506+
statusIcon, statusColor = "➖", "N/A"
1507+
}
15141508
displayName := strings.ToUpper(strings.ReplaceAll(checkName, "_", " "))
15151509
fmt.Printf("%s %s [%s]\n", statusIcon, displayName, statusColor)
15161510
fmt.Println("───────────────────────────────────────────────────────────────")

0 commit comments

Comments
 (0)