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>
}
// 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
// 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"`)
--- /dev/null
+go build
+
+-- go.mod --
+module test
+
+go 1.0
+
+-- p.go --
+package p