Commit 7ebe3509 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
parent 5d392600
...@@ -41,6 +41,11 @@ func TestInvalidLang(t *testing.T) { ...@@ -41,6 +41,11 @@ func TestInvalidLang(t *testing.T) {
t.Error("compilation with -lang=go9.99 succeeded unexpectedly") 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 { if testLang(t, "go1.8", src, outfile) == nil {
t.Error("compilation with -lang=go1.8 succeeded unexpectedly") t.Error("compilation with -lang=go1.8 succeeded unexpectedly")
} }
......
...@@ -1444,7 +1444,7 @@ func checkLang() { ...@@ -1444,7 +1444,7 @@ func checkLang() {
if err != nil { if err != nil {
log.Fatalf("internal error parsing default lang %q: %v", def, err) 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) log.Fatalf("invalid value %q for -lang: max known version is %q", flag_lang, def)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment