1
0
mirror of https://github.com/golang/go synced 2024-11-12 08:10:21 -07:00

cmd/compile: correct check for valid -lang version

Change-Id: Iad10d0a2dbc8e12e9f776c6cfb34070f584fd439
Reviewed-on: https://go-review.googlesource.com/c/149057
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
This commit is contained in:
Ian Lance Taylor 2018-11-12 10:38:02 -08:00
parent 5d39260079
commit 7ebe35093d
2 changed files with 6 additions and 1 deletions

View File

@ -41,6 +41,11 @@ func TestInvalidLang(t *testing.T) {
t.Error("compilation with -lang=go9.99 succeeded unexpectedly")
}
// This test will have to be adjusted if we ever reach 1.99 or 2.0.
if testLang(t, "go1.99", src, outfile) == nil {
t.Error("compilation with -lang=go1.99 succeeded unexpectedly")
}
if testLang(t, "go1.8", src, outfile) == nil {
t.Error("compilation with -lang=go1.8 succeeded unexpectedly")
}

View File

@ -1444,7 +1444,7 @@ func checkLang() {
if err != nil {
log.Fatalf("internal error parsing default lang %q: %v", def, err)
}
if langWant.major > defVers.major || (langWant.major == defVers.major && langWant.major > defVers.minor) {
if langWant.major > defVers.major || (langWant.major == defVers.major && langWant.minor > defVers.minor) {
log.Fatalf("invalid value %q for -lang: max known version is %q", flag_lang, def)
}
}