Skip to content

Commit fb86598

Browse files
mdempskythanm
authored andcommitted
[release-branch.go1.22] cmd/compile: accept -lang=go1 as -lang=go1.0
Fixes #65619. Change-Id: I55fef8cf7be4654c7242462d45f12999e0c91c02 Reviewed-on: https://go-review.googlesource.com/c/go/+/562322 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Bryan Mills <[email protected]> (cherry picked from commit 08370dc) Reviewed-on: https://go-review.googlesource.com/c/go/+/562815
1 parent 6fbd01a commit fb86598

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/cmd/compile/internal/types/goversion.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func AllowsGoVersion(major, minor int) bool {
3434
}
3535

3636
// ParseLangFlag verifies that the -lang flag holds a valid value, and
37-
// exits if not. It initializes data used by langSupported.
37+
// exits if not. It initializes data used by AllowsGoVersion.
3838
func ParseLangFlag() {
3939
if base.Flag.Lang == "" {
4040
return
@@ -59,6 +59,10 @@ func ParseLangFlag() {
5959

6060
// parseLang parses a -lang option into a langVer.
6161
func parseLang(s string) (lang, error) {
62+
if s == "go1" { // cmd/go's new spelling of "go1.0" (#65528)
63+
s = "go1.0"
64+
}
65+
6266
matches := goVersionRE.FindStringSubmatch(s)
6367
if matches == nil {
6468
return lang{}, fmt.Errorf(`should be something like "go1.12"`)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
go build
2+
3+
-- go.mod --
4+
module test
5+
6+
go 1.0
7+
8+
-- p.go --
9+
package p

0 commit comments

Comments
 (0)