From 9534a5b475fe60c281fb379f8bf184f4f361034c Mon Sep 17 00:00:00 2001 From: Dayang Shen Date: Fri, 17 Dec 2021 18:01:55 +0800 Subject: [PATCH] Improve text output by printing out successult results --- pkg/env/azure.go | 2 +- pkg/formatters/text.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/env/azure.go b/pkg/env/azure.go index 6d1079b..206befd 100644 --- a/pkg/env/azure.go +++ b/pkg/env/azure.go @@ -11,7 +11,7 @@ const ( ) func getAzureFlags() []string { - // IDMS should exist on Azure VMs + // IMDS should exist on Azure VMs client := &http.Client{ Timeout: time.Second, } diff --git a/pkg/formatters/text.go b/pkg/formatters/text.go index d76a193..4a74d71 100644 --- a/pkg/formatters/text.go +++ b/pkg/formatters/text.go @@ -12,13 +12,17 @@ type TextFormatter struct{} func (f *TextFormatter) WriteResults(w io.Writer, results []*base.CheckResult) error { failures := []*base.CheckResult{} for _, r := range results { - if !r.Ok() { + if r.Ok() { + fmt.Fprintf(w, "[%s] %s\n", r.Checker, r.Description) + } else { failures = append(failures, r) } } + fmt.Fprintf(w, "------------------------------\n") + if len(failures) == 0 { - fmt.Fprintf(w, "All checks passed!\n") + fmt.Fprintf(w, "All %d checks passed!\n", len(results)) return nil }