internal/worker: re-analyze vendor issue projects

We considered vendor errors unrecoverable, i.e., something we cannot do
anything about. Recently we discovered that is not the case. We now need
to re-enable them and the only way to do that is to re-enable analysis
of everything. We also catch the mod vendor issues now separately.

Note that a follow-up CL will revert some the changes made here, namely
the one where don't check if the error is recoverable.

Change-Id: Iaf46c5799dd9e61d90588d8dcef23e16d85ad437
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/608575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/worker/analysis.go b/internal/worker/analysis.go
index 41863f6..071bda2 100644
--- a/internal/worker/analysis.go
+++ b/internal/worker/analysis.go
@@ -214,6 +214,8 @@
 			// branch should never be reached. We keep this for sanity and to
 			// catch any regressions.
 			err = fmt.Errorf("%v: %w", err, derrors.LoadPackagesNoGoModError)
+		case isModVendor(err):
+			err = fmt.Errorf("%v: %w", err, derrors.LoadVendorError)
 		case isNoRequiredModule(err):
 			err = fmt.Errorf("%v: %w", err, derrors.LoadPackagesNoRequiredModuleError)
 		case isTooManyFiles(err):
@@ -222,8 +224,6 @@
 			err = fmt.Errorf("%v: %w", err, derrors.LoadPackagesMissingGoSumEntryError)
 		case isReplacingWithLocalPath(err):
 			err = fmt.Errorf("%v: %w", err, derrors.LoadPackagesImportedLocalError)
-		case isModVendor(err):
-			err = fmt.Errorf("%v: %w", err, derrors.LoadVendorError)
 		case isProxyCacheMiss(err):
 			err = fmt.Errorf("%v: %w", err, derrors.ProxyError)
 		case isSandboxRelatedIssue(err):
diff --git a/internal/worker/govulncheck_scan.go b/internal/worker/govulncheck_scan.go
index e75b441..c2c49f1 100644
--- a/internal/worker/govulncheck_scan.go
+++ b/internal/worker/govulncheck_scan.go
@@ -157,7 +157,9 @@
 	}
 	// Otherwise, skip if the error is not recoverable. The version of the
 	// module has not changed, so we'll get the same error anyhow.
-	return unrecoverableError(ws.ErrorCategory), nil
+	// TODO re-enable this
+	// return unrecoverableError(ws.ErrorCategory), nil
+	return false, nil
 }
 
 // unrecoverableError returns true iff errorCategory encodes that
@@ -342,6 +344,8 @@
 	// classify scan error first
 	if err != nil {
 		switch {
+		case isModVendor(err):
+			err = fmt.Errorf("%v: %w", err, derrors.LoadVendorError)
 		case isGovulncheckLoadError(err) || isBuildIssue(err):
 			err = fmt.Errorf("%v: %w", err, derrors.LoadPackagesError)
 		case isNoRequiredModule(err):
@@ -356,10 +360,6 @@
 			// Should be subsumed by LoadPackagesError, kept for sanity.
 			// and to catch unexpected changes in govulncheck output.
 			err = fmt.Errorf("%v: %w", err, derrors.LoadPackagesImportedLocalError)
-		case isModVendor(err):
-			// Should be subsumed by LoadPackagesError, kept for sanity.
-			// and to catch unexpected changes in govulncheck output.
-			err = fmt.Errorf("%v: %w", err, derrors.LoadVendorError)
 		case isMissingGoMod(err) || isNoModulesSpecified(err):
 			// Should be subsumed by LoadPackagesError, kept for sanity
 			// and to catch unexpected changes in govulncheck output.