diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2024-02-07 17:25:48 -0800 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2024-02-08 21:36:02 +0000 |
| commit | 08370dcd9af8122956fc3ab024889c5357fffd5a (patch) | |
| tree | 61e448aa6e1a782a9da696f146913c917e296439 /src | |
| parent | 58fea5dfaff26736ff20db6158940ef4f6812a8a (diff) | |
| download | go-08370dcd9af8122956fc3ab024889c5357fffd5a.tar.xz | |
cmd/compile: accept -lang=go1 as -lang=go1.0
Fixes #65528.
Change-Id: I55fef8cf7be4654c7242462d45f12999e0c91c02
Reviewed-on: https://go-review.googlesource.com/c/go/+/562322
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/types/goversion.go | 6 | ||||
| -rw-r--r-- | src/cmd/go/testdata/script/build_issue_65528.txt | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types/goversion.go b/src/cmd/compile/internal/types/goversion.go index c57493a5cb..ac08a49d0c 100644 --- a/src/cmd/compile/internal/types/goversion.go +++ b/src/cmd/compile/internal/types/goversion.go @@ -34,7 +34,7 @@ func AllowsGoVersion(major, minor int) bool { } // ParseLangFlag verifies that the -lang flag holds a valid value, and -// exits if not. It initializes data used by langSupported. +// exits if not. It initializes data used by AllowsGoVersion. func ParseLangFlag() { if base.Flag.Lang == "" { return @@ -59,6 +59,10 @@ func ParseLangFlag() { // parseLang parses a -lang option into a langVer. func parseLang(s string) (lang, error) { + if s == "go1" { // cmd/go's new spelling of "go1.0" (#65528) + s = "go1.0" + } + matches := goVersionRE.FindStringSubmatch(s) if matches == nil { return lang{}, fmt.Errorf(`should be something like "go1.12"`) diff --git a/src/cmd/go/testdata/script/build_issue_65528.txt b/src/cmd/go/testdata/script/build_issue_65528.txt new file mode 100644 index 0000000000..ab4d62bbb2 --- /dev/null +++ b/src/cmd/go/testdata/script/build_issue_65528.txt @@ -0,0 +1,9 @@ +go build + +-- go.mod -- +module test + +go 1.0 + +-- p.go -- +package p |
