mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Fix diagnostics
This commit is contained in:
@@ -782,7 +782,7 @@ func getVersionWhenGoModVersionTooHigh(v versionInfo) (msg, version string) {
|
||||
") is above the supported range (" + minGoVersion + "-" + maxGoVersion +
|
||||
"). Writing an environment file not specifying any version of Go."
|
||||
version = ""
|
||||
diagnostics.EmitUnsupportedVersionGoMod(msg)
|
||||
diagnostics.EmitGoModVersionTooHigh(msg)
|
||||
|
||||
return msg, version
|
||||
}
|
||||
@@ -799,7 +799,7 @@ func getVersionWhenGoModVersionTooLow(v versionInfo) (msg, version string) {
|
||||
"). No version of Go installed. Writing an environment file specifying the " +
|
||||
"minimum supported version of Go (" + minGoVersion + ")."
|
||||
version = minGoVersion
|
||||
diagnostics.EmitNoGoEnv(msg)
|
||||
diagnostics.EmitGoModVersionTooLowAndNoGoEnv(msg)
|
||||
} else if outsideSupportedRange(v.goEnvVersion) {
|
||||
// The version of Go that is installed is outside of the supported range. The version
|
||||
// in the `go.mod` file is below the supported range. Go versions are generally
|
||||
@@ -811,7 +811,7 @@ func getVersionWhenGoModVersionTooLow(v versionInfo) (msg, version string) {
|
||||
"Writing an environment file specifying the minimum supported version of Go (" +
|
||||
minGoVersion + ")."
|
||||
version = minGoVersion
|
||||
diagnostics.EmitVersionGoModSupportedAndGoEnvUnsupported(msg)
|
||||
diagnostics.EmitGoModVersionTooLowAndEnvVersionUnsupported(msg)
|
||||
} else {
|
||||
// The version of Go that is installed is supported. The version in the `go.mod` file is
|
||||
// below the supported range. We do not install a version of Go.
|
||||
@@ -819,7 +819,7 @@ func getVersionWhenGoModVersionTooLow(v versionInfo) (msg, version string) {
|
||||
") is supported and is high enough for the version found in the `go.mod` file (" +
|
||||
v.goModVersion + "). Writing an environment file not specifying any version of Go."
|
||||
version = ""
|
||||
diagnostics.EmitVersionGoModNotHigherVersionEnvironment(msg)
|
||||
diagnostics.EmitGoModVersionTooLowAndEnvVersionSupported(msg)
|
||||
}
|
||||
|
||||
return msg, version
|
||||
@@ -834,7 +834,7 @@ func getVersionWhenGoModVersionSupported(v versionInfo) (msg, version string) {
|
||||
msg = "No version of Go installed. Writing an environment file specifying the version " +
|
||||
"of Go found in the `go.mod` file (" + v.goModVersion + ")."
|
||||
version = v.goModVersion
|
||||
diagnostics.EmitNoGoEnv(msg)
|
||||
diagnostics.EmitGoModVersionSupportedAndNoGoEnv(msg)
|
||||
} else if outsideSupportedRange(v.goEnvVersion) {
|
||||
// The version of Go that is installed is outside of the supported range. The version in
|
||||
// the `go.mod` file is supported. We install the version from the `go.mod` file.
|
||||
@@ -843,7 +843,7 @@ func getVersionWhenGoModVersionSupported(v versionInfo) (msg, version string) {
|
||||
"Writing an environment file specifying the version of Go from the `go.mod` file (" +
|
||||
v.goModVersion + ")."
|
||||
version = v.goModVersion
|
||||
diagnostics.EmitVersionGoModSupportedAndGoEnvUnsupported(msg)
|
||||
diagnostics.EmitGoModVersionSupportedAndGoEnvUnsupported(msg)
|
||||
} else if semver.Compare("v"+v.goModVersion, "v"+v.goEnvVersion) > 0 {
|
||||
// The version of Go that is installed is supported. The version in the `go.mod` file is
|
||||
// supported and is higher than the version that is installed. We install the version from
|
||||
@@ -853,7 +853,7 @@ func getVersionWhenGoModVersionSupported(v versionInfo) (msg, version string) {
|
||||
"). Writing an environment file specifying the version of Go from the `go.mod` " +
|
||||
"file (" + v.goModVersion + ")."
|
||||
version = v.goModVersion
|
||||
diagnostics.EmitVersionGoModHigherVersionEnvironment(msg)
|
||||
diagnostics.EmitGoModVersionSupportedHigherGoEnv(msg)
|
||||
} else {
|
||||
// The version of Go that is installed is supported. The version in the `go.mod` file is
|
||||
// supported and is lower than or equal to the version that is installed. We do not install
|
||||
@@ -862,7 +862,7 @@ func getVersionWhenGoModVersionSupported(v versionInfo) (msg, version string) {
|
||||
") is supported and is high enough for the version found in the `go.mod` file (" +
|
||||
v.goModVersion + "). Writing an environment file not specifying any version of Go."
|
||||
version = ""
|
||||
diagnostics.EmitVersionGoModNotHigherVersionEnvironment(msg)
|
||||
diagnostics.EmitGoModVersionSupportedLowerEqualGoEnv(msg)
|
||||
}
|
||||
|
||||
return msg, version
|
||||
|
||||
@@ -194,20 +194,9 @@ func EmitRelativeImportPaths() {
|
||||
)
|
||||
}
|
||||
|
||||
func EmitUnsupportedVersionGoMod(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-unsupported-version-in-go-mod",
|
||||
"Unsupported Go version in `go.mod` file",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
noLocation,
|
||||
)
|
||||
}
|
||||
|
||||
func EmitNoGoModAndNoGoEnv(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-no-go-mod-and-no-go-env",
|
||||
"go/autobuilder/env-no-go-mod-no-go-env",
|
||||
"No `go.mod` file found and no Go version in environment",
|
||||
msg,
|
||||
severityNote,
|
||||
@@ -216,17 +205,6 @@ func EmitNoGoModAndNoGoEnv(msg string) {
|
||||
)
|
||||
}
|
||||
|
||||
func EmitNoGoEnv(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-no-go-env",
|
||||
"No Go version in environment",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
noLocation,
|
||||
)
|
||||
}
|
||||
|
||||
func EmitNoGoModAndGoEnvUnsupported(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-no-go-mod-go-env-unsupported",
|
||||
@@ -249,10 +227,10 @@ func EmitNoGoModAndGoEnvSupported(msg string) {
|
||||
)
|
||||
}
|
||||
|
||||
func EmitVersionGoModHigherVersionEnvironment(msg string) {
|
||||
func EmitGoModVersionTooHigh(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-version-go-mod-higher-than-go-env",
|
||||
"The Go version in `go.mod` file is higher than the Go version in environment",
|
||||
"go/autobuilder/env-go-mod-version-too-high",
|
||||
"Go version in `go.mod` file above supported range",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
@@ -260,10 +238,10 @@ func EmitVersionGoModHigherVersionEnvironment(msg string) {
|
||||
)
|
||||
}
|
||||
|
||||
func EmitVersionGoModSupportedAndGoEnvUnsupported(msg string) {
|
||||
func EmitGoModVersionTooLowAndNoGoEnv(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-version-go-mod-higher-than-go-env",
|
||||
"The Go version in `go.mod` file is higher than the Go version in environment",
|
||||
"go/autobuilder/env-go-mod-version-too-low-no-go-env",
|
||||
"Go version in `go.mod` file below supported range and no Go version in environment",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
@@ -271,10 +249,65 @@ func EmitVersionGoModSupportedAndGoEnvUnsupported(msg string) {
|
||||
)
|
||||
}
|
||||
|
||||
func EmitVersionGoModNotHigherVersionEnvironment(msg string) {
|
||||
func EmitGoModVersionTooLowAndEnvVersionUnsupported(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-version-go-mod-lower-than-or-equal-to-go-env",
|
||||
"The Go version in `go.mod` file is lower than or equal to the Go version in environment",
|
||||
"go/autobuilder/env-go-mod-version-too-low-go-env-unsupported",
|
||||
"Go version in `go.mod` file below supported range and Go version in environment unsupported",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
noLocation,
|
||||
)
|
||||
}
|
||||
|
||||
func EmitGoModVersionTooLowAndEnvVersionSupported(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-go-mod-version-too-low-go-env-supported",
|
||||
"Go version in `go.mod` file below supported range and Go version in environment supported",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
noLocation,
|
||||
)
|
||||
}
|
||||
|
||||
func EmitGoModVersionSupportedAndNoGoEnv(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-go-mod-version-supported-no-go-env",
|
||||
"Go version in `go.mod` file in supported range and no Go version in environment",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
noLocation,
|
||||
)
|
||||
}
|
||||
|
||||
func EmitGoModVersionSupportedAndGoEnvUnsupported(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-go-mod-version-supported-go-env-unsupported",
|
||||
"Go version in `go.mod` file in supported range and Go version in environment unsupported",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
noLocation,
|
||||
)
|
||||
}
|
||||
|
||||
func EmitGoModVersionSupportedHigherGoEnv(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-go-mod-version-supported-higher-than-go-env",
|
||||
"The Go version in `go.mod` file is supported and higher than the Go version in environment",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
noLocation,
|
||||
)
|
||||
}
|
||||
|
||||
func EmitGoModVersionSupportedLowerEqualGoEnv(msg string) {
|
||||
emitDiagnostic(
|
||||
"go/autobuilder/env-go-mod-version-supported-lower-than-or-equal-to-go-env",
|
||||
"The Go version in `go.mod` file is supported and lower than or equal to the Go version in environment",
|
||||
msg,
|
||||
severityNote,
|
||||
telemetryOnly,
|
||||
|
||||
Reference in New Issue
Block a user