mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Go: Include versions in newer Go version needed diagnostic
This commit is contained in:
@@ -546,7 +546,7 @@ func installDependenciesAndBuild() {
|
||||
// This diagnostic is not required if the system Go version is 1.21 or greater, since the
|
||||
// Go tooling should install required Go versions as needed.
|
||||
if semver.Compare(getEnvGoSemVer(), "v1.21.0") < 0 && goVersionInfo.Found && semver.Compare("v"+goVersionInfo.Version, getEnvGoSemVer()) > 0 {
|
||||
diagnostics.EmitNewerGoVersionNeeded()
|
||||
diagnostics.EmitNewerGoVersionNeeded(getEnvGoSemVer(), "v"+goVersionInfo.Version)
|
||||
if val, _ := os.LookupEnv("GITHUB_ACTIONS"); val == "true" {
|
||||
log.Printf("The go.mod version is newer than the installed version of Go. Consider adding an actions/setup-go step to your workflow.\n")
|
||||
}
|
||||
|
||||
@@ -168,11 +168,11 @@ func EmitCannotFindPackages(pkgPaths []string) {
|
||||
)
|
||||
}
|
||||
|
||||
func EmitNewerGoVersionNeeded() {
|
||||
func EmitNewerGoVersionNeeded(installedVersion string, requiredVersion string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/newer-go-version-needed",
|
||||
"Newer Go version needed",
|
||||
"The detected version of Go is lower than the version specified in `go.mod`. [Install a newer version](https://github.com/actions/setup-go#basic).",
|
||||
"Version `"+installedVersion+"` of Go is installed, but this is lower than `"+requiredVersion+"` required by your project's `go.mod`. [Install a newer version of Go before analyzing your project](https://github.com/actions/setup-go#basic).",
|
||||
severityError,
|
||||
fullVisibility,
|
||||
noLocation,
|
||||
|
||||
Reference in New Issue
Block a user