Emit diagnostic to pass third inegration tests

This commit is contained in:
Owen Mansel-Chan
2023-02-28 16:57:24 +00:00
parent 4fe4dfbf83
commit 2a41e6ae66
2 changed files with 13 additions and 1 deletions

View File

@@ -102,6 +102,16 @@ func EmitPackageDifferentOSArchitecture(pkgPath string) {
)
}
func EmitCannotFindPackage(pkgPath string) {
emitDiagnostic("go/extractor/package-not-found",
"Package "+pkgPath+" could not be found",
"Check that the path is correct. If it is a private package, make sure it can be accessed. If it is contained in the repository then you may need a [custom build command](https://docs.github.com/en/github-ae@latest/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language)",
severityError, false,
true, true, true,
"", 0, 0, 0, 0,
)
}
func EmitNewerGoVersionNeeded() {
emitDiagnostic("go/autobuilder/newer-go-version-needed",
"Newer Go version needed",

View File

@@ -151,8 +151,10 @@ func ExtractWithFlags(buildFlags []string, patterns []string) error {
if strings.Contains(errString, "build constraints exclude all Go files in ") {
// `err` is a NoGoError from the package cmd/go/internal/load, which we cannot access as it is internal
diagnostics.EmitPackageDifferentOSArchitecture(pkg.PkgPath)
} else if strings.Contains(errString, "cannot find package") ||
strings.Contains(errString, "no required module provides package") {
diagnostics.EmitCannotFindPackage(pkg.PkgPath)
}
extraction.extractError(tw, err, lbl, i)
}
}