From f69de671333b611ab6b6f21f8ff0ab53f6d96c61 Mon Sep 17 00:00:00 2001 From: Ian Cottrell Date: Thu, 13 Jul 2023 00:42:34 -0400 Subject: [PATCH] internal/scan: fix double line spacing Change-Id: I67d096196a4e54a12b4213c8011406a9ff65759e Reviewed-on: https://go-review.googlesource.com/c/vuln/+/508921 TryBot-Result: Gopher Robot Reviewed-by: Julie Qiu Reviewed-by: Julie Qiu Run-TryBot: Ian Cottrell Auto-Submit: Ian Cottrell --- cmd/govulncheck/testdata/source_informational_text.ct | 1 - internal/scan/testdata/no-vulns.txt | 1 - internal/scan/testdata/platform-all.txt | 1 - internal/scan/testdata/platform-one-arch-only.txt | 1 - internal/scan/testdata/platform-one-import.txt | 1 - internal/scan/testdata/platform-two-imports.txt | 1 - internal/scan/testdata/platform-two-os-only.txt | 1 - internal/scan/text.go | 9 +-------- 8 files changed, 1 insertion(+), 15 deletions(-) diff --git a/cmd/govulncheck/testdata/source_informational_text.ct b/cmd/govulncheck/testdata/source_informational_text.ct index 3becfc57..a8d1047e 100644 --- a/cmd/govulncheck/testdata/source_informational_text.ct +++ b/cmd/govulncheck/testdata/source_informational_text.ct @@ -5,7 +5,6 @@ Using go1.18 and govulncheck@v0.0.0-00000000000-20000101010101 with vulnerabilit Scanning your code and P packages across M dependent modules for known vulnerabilities... - === Informational === Found 1 vulnerability in packages that you import, but there are no call diff --git a/internal/scan/testdata/no-vulns.txt b/internal/scan/testdata/no-vulns.txt index 3ea6a00f..dd753c19 100644 --- a/internal/scan/testdata/no-vulns.txt +++ b/internal/scan/testdata/no-vulns.txt @@ -1,6 +1,5 @@ Using govulncheck with vulnerability data from . - === Informational === Found 1 vulnerability in packages that you import, but there are no call diff --git a/internal/scan/testdata/platform-all.txt b/internal/scan/testdata/platform-all.txt index e3b5ce05..1c456fe9 100644 --- a/internal/scan/testdata/platform-all.txt +++ b/internal/scan/testdata/platform-all.txt @@ -1,6 +1,5 @@ Using govulncheck with vulnerability data from . - === Informational === Found 1 vulnerability in packages that you import, but there are no call diff --git a/internal/scan/testdata/platform-one-arch-only.txt b/internal/scan/testdata/platform-one-arch-only.txt index 55f41844..2884b459 100644 --- a/internal/scan/testdata/platform-one-arch-only.txt +++ b/internal/scan/testdata/platform-one-arch-only.txt @@ -1,6 +1,5 @@ Using govulncheck with vulnerability data from . - === Informational === Found 1 vulnerability in packages that you import, but there are no call diff --git a/internal/scan/testdata/platform-one-import.txt b/internal/scan/testdata/platform-one-import.txt index acd19036..80d3cc8e 100644 --- a/internal/scan/testdata/platform-one-import.txt +++ b/internal/scan/testdata/platform-one-import.txt @@ -1,6 +1,5 @@ Using govulncheck with vulnerability data from . - === Informational === Found 1 vulnerability in packages that you import, but there are no call diff --git a/internal/scan/testdata/platform-two-imports.txt b/internal/scan/testdata/platform-two-imports.txt index c4b1bf28..0445288d 100644 --- a/internal/scan/testdata/platform-two-imports.txt +++ b/internal/scan/testdata/platform-two-imports.txt @@ -1,6 +1,5 @@ Using govulncheck with vulnerability data from . - === Informational === Found 1 vulnerability in packages that you import, but there are no call diff --git a/internal/scan/testdata/platform-two-os-only.txt b/internal/scan/testdata/platform-two-os-only.txt index 53bcb942..68e54c83 100644 --- a/internal/scan/testdata/platform-two-os-only.txt +++ b/internal/scan/testdata/platform-two-os-only.txt @@ -1,6 +1,5 @@ Using govulncheck with vulnerability data from . - === Informational === Found 1 vulnerability in packages that you import, but there are no call diff --git a/internal/scan/text.go b/internal/scan/text.go index 51e7bf4d..0364d5ea 100644 --- a/internal/scan/text.go +++ b/internal/scan/text.go @@ -130,9 +130,6 @@ func (h *TextHandler) byVulnerability(findings []*findingSummary) { called := 0 for _, findings := range byVuln { if isCalled(findings) { - if called > 0 { - h.print("\n") - } h.vulnerability(called, findings) called++ } @@ -141,7 +138,6 @@ func (h *TextHandler) byVulnerability(findings []*findingSummary) { if unCalled == 0 { return } - h.print("\n") h.style(sectionStyle, "=== Informational ===\n") h.print("\nFound ", unCalled) h.print(choose(unCalled == 1, ` vulnerability`, ` vulnerabilities`)) @@ -151,9 +147,6 @@ func (h *TextHandler) byVulnerability(findings []*findingSummary) { index := 0 for _, findings := range byVuln { if !isCalled(findings) { - if index > 0 { - h.print("\n") - } h.vulnerability(index, findings) index++ } @@ -226,6 +219,7 @@ func (h *TextHandler) vulnerability(index int, findings []*findingSummary) { } h.traces(module) } + h.print("\n") } func (h *TextHandler) traces(traces []*findingSummary) { @@ -258,7 +252,6 @@ func (h *TextHandler) traces(traces []*findingSummary) { func (h *TextHandler) summary(findings []*findingSummary) { counters := counters(findings) - h.print("\n") if counters.VulnerabilitiesCalled == 0 { h.print("No vulnerabilities found.\n") return