From 71ebdd82089885e04ace5cd342cdb4933facc949 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sun, 1 Mar 2026 22:37:28 +0100 Subject: [PATCH 1/2] using tabwriter fix for better output. --- cmd/go2junit/go2junit.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/go2junit/go2junit.go b/cmd/go2junit/go2junit.go index 49bf657..18c3722 100644 --- a/cmd/go2junit/go2junit.go +++ b/cmd/go2junit/go2junit.go @@ -10,6 +10,7 @@ import ( "path/filepath" "runtime/debug" "strings" + "text/tabwriter" ) func getVersion() string { @@ -140,15 +141,19 @@ func main() { } fmt.Printf("\n\nSUMMARY\n\n") - fmt.Printf("%-60s %-10s %-10s %-10s %-10s %-10s %-10s\n\n", "SUITE", "COUNT", "PASSED", "FAILURES", "ERRORS", "DISABLED", "SKIPPED") + w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) + + fmt.Fprintf(w, "%s\t%-10s\t%-10s\t%-10s\t%-10s\t%-10s\t%-10s\n", + "SUITE", "COUNT", "PASSED", "FAILURES", "ERRORS", "DISABLED", "SKIPPED") + for _, suite := range testsuites.Suites { - fmt.Printf("%-60s %-10d %-10d %-10d %-10d %-10d %-10d\n", + fmt.Fprintf(w, "%s\t%-10d\t%-10d\t%-10d\t%-10d\t%-10d\t%-10d\n", suite.Name, suite.TestCount, suite.TestCount-suite.Failures-suite.Errors-suite.Skipped-suite.Disabled, suite.Failures, suite.Errors, suite.Disabled, suite.Skipped) } - fmt.Printf("\n%-60s %-10d %-10d %-10d %-10d %-10d %-10d\n", + fmt.Fprintf(w, "\n%s\t%10d\t%10d\t%10d\t%10d\t%10d\t%10d\n", "TOTAL", testsuites.Tests, testsuites.Tests-testsuites.Failures-testsuites.Errors-testsuites.Skipped-testsuites.Disabled, From f6b65ee12a17db4af022ea01fd2a08ece281086c Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sun, 1 Mar 2026 22:42:37 +0100 Subject: [PATCH 2/2] fixed summary --- cmd/go2junit/go2junit.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/go2junit/go2junit.go b/cmd/go2junit/go2junit.go index 18c3722..8c16c1f 100644 --- a/cmd/go2junit/go2junit.go +++ b/cmd/go2junit/go2junit.go @@ -153,11 +153,12 @@ func main() { suite.TestCount-suite.Failures-suite.Errors-suite.Skipped-suite.Disabled, suite.Failures, suite.Errors, suite.Disabled, suite.Skipped) } - fmt.Fprintf(w, "\n%s\t%10d\t%10d\t%10d\t%10d\t%10d\t%10d\n", + fmt.Fprintf(w, "%s\t%-10d\t%-10d\t%-10d\t%-10d\t%-10d\t%-10d\n", "TOTAL", testsuites.Tests, testsuites.Tests-testsuites.Failures-testsuites.Errors-testsuites.Skipped-testsuites.Disabled, testsuites.Failures, testsuites.Errors, testsuites.Disabled, testsuites.Skipped) + w.Flush() if testsuites.Failures+testsuites.Errors+testsuites.Skipped+testsuites.Disabled > 0 { fmt.Printf("\nFAILED TESTS\n\n")