mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Go: Run go with a valid toolchain version if we have found an invalid one
This commit is contained in:
@@ -212,6 +212,16 @@ func LoadGoModules(emitDiagnostics bool, goModFilePaths []string) []*GoModule {
|
||||
if modFile.Toolchain == nil && modFile.Go != nil &&
|
||||
!toolchainVersionRe.Match([]byte(modFile.Go.Version)) && semver.Compare("v"+modFile.Go.Version, "v1.21.0") >= 0 {
|
||||
diagnostics.EmitInvalidToolchainVersion(goModFilePath, modFile.Go.Version)
|
||||
|
||||
modPath := filepath.Dir(goModFilePath)
|
||||
|
||||
log.Printf(
|
||||
"`%s` is not a valid toolchain version, trying to install it explicitly using the canonical representation in `%s`.",
|
||||
modFile.Go.Version,
|
||||
modPath,
|
||||
)
|
||||
|
||||
toolchain.InstallVersion(modPath, modFile.Go.Version)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user