internal/scan: move exit code handling into the error

Change-Id: I2ab507685df36190e218ff49defd1aed8edea860
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/487976
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Julie Qiu <julieqiu@google.com>
diff --git a/cmd/govulncheck/main_command_118_test.go b/cmd/govulncheck/main_command_118_test.go
index 804d55f..e4f9ae0 100644
--- a/cmd/govulncheck/main_command_118_test.go
+++ b/cmd/govulncheck/main_command_118_test.go
@@ -128,7 +128,7 @@
 	if err != nil {
 		return nil, err
 	}
-	ts.DisableLogging = false
+	ts.DisableLogging = true
 	ts.Commands["govulncheck"] = func(args []string, inputFile string) ([]byte, error) {
 		govulndbURI, err := web.URLFromFilePath(vulndbDir)
 		if err != nil {
@@ -157,7 +157,7 @@
 	heapGoRegexp                 = regexp.MustCompile(`heap\.go:(\d+)`)
 	progressRegexp               = regexp.MustCompile(`Scanning your code and (\d+) packages across (\d+)`)
 	govulncheckRegexp            = regexp.MustCompile(`govulncheck@v(.*) with`)
-	govulncheckBinaryErrorRegexp = regexp.MustCompile(`govulncheck: (.*) is a file`)
+	govulncheckBinaryErrorRegexp = regexp.MustCompile(`"([^"]*") is a file`)
 	govulncheckJSONRegexp        = regexp.MustCompile(`"govulncheck@v(.*)",`)
 	vulndbRegexp                 = regexp.MustCompile(`file:///(.*)/testdata/vulndb`)
 	gorootRegexp                 = regexp.MustCompile(`package (.*) is not in GOROOT (.*)`)