Skip to content

Commit c21b1a6

Browse files
committed
Be clear when no Go version in environment file
1 parent 5d06adb commit c21b1a6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

go/extractor/cli/go-autobuilder/go-autobuilder.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,12 +741,14 @@ func outsideSupportedRange(version string) bool {
741741
func checkForUnsupportedVersions(v versionInfo) (msg, version string) {
742742
if v.goModVersionFound && outsideSupportedRange(v.goModVersion) {
743743
msg = "The version of Go found in the `go.mod` file (" + v.goModVersion +
744-
") is outside of the supported range (" + minGoVersion + "-" + maxGoVersion + ")."
744+
") is outside of the supported range (" + minGoVersion + "-" + maxGoVersion +
745+
"). Writing an environment file not specifying any version of Go."
745746
version = ""
746747
diagnostics.EmitUnsupportedVersionGoMod(msg)
747748
} else if v.goEnvVersionFound && outsideSupportedRange(v.goEnvVersion) {
748749
msg = "The version of Go installed in the environment (" + v.goEnvVersion +
749-
") is outside of the supported range (" + minGoVersion + "-" + maxGoVersion + ")."
750+
") is outside of the supported range (" + minGoVersion + "-" + maxGoVersion +
751+
"). Writing an environment file not specifying any version of Go."
750752
version = ""
751753
diagnostics.EmitUnsupportedVersionEnvironment(msg)
752754
}
@@ -774,7 +776,8 @@ func checkForVersionsNotFound(v versionInfo) (msg, version string) {
774776
}
775777

776778
if v.goEnvVersionFound && !v.goModVersionFound {
777-
msg = "No `go.mod` file found. Version " + v.goEnvVersion + " installed in the environment."
779+
msg = "No `go.mod` file found. Version " + v.goEnvVersion + " installed in the " +
780+
"environment. Writing an environment file not specifying any version of Go."
778781
version = ""
779782
diagnostics.EmitNoGoMod(msg)
780783
}
@@ -796,7 +799,8 @@ func compareVersions(v versionInfo) (msg, version string) {
796799
diagnostics.EmitVersionGoModHigherVersionEnvironment(msg)
797800
} else {
798801
msg = "The version of Go installed in the environment (" + v.goEnvVersion +
799-
") is high enough for the version found in the `go.mod` file (" + v.goModVersion + ")."
802+
") is high enough for the version found in the `go.mod` file (" + v.goModVersion +
803+
"). Writing an environment file not specifying any version of Go."
800804
version = ""
801805
diagnostics.EmitVersionGoModNotHigherVersionEnvironment(msg)
802806
}

0 commit comments

Comments
 (0)