@@ -308,6 +308,7 @@ var laxGoVersionRE = lazyregexp.New(`^v?(([1-9][0-9]*)\.(0|[1-9][0-9]*))([^0-9].
308
308
309
309
// Toolchains must be named beginning with `go1`,
310
310
// like "go1.20.3" or "go1.20.3-gccgo". As a special case, "default" is also permitted.
311
+ // TODO(samthanawalla): Replace regex with https://pkg.go.dev/go/version#IsValid in 1.23+
311
312
var ToolchainRE = lazyregexp .New (`^default$|^go1($|\.)` )
312
313
313
314
func (f * File ) add (errs * ErrorList , block * LineBlock , line * Line , verb string , args []string , fix VersionFixer , strict bool ) {
@@ -384,7 +385,7 @@ func (f *File) add(errs *ErrorList, block *LineBlock, line *Line, verb string, a
384
385
errorf ("toolchain directive expects exactly one argument" )
385
386
return
386
387
} else if strict && ! ToolchainRE .MatchString (args [0 ]) {
387
- errorf ("invalid toolchain version '%s': must match format go1.23.0 or local " , args [0 ])
388
+ errorf ("invalid toolchain version '%s': must match format go1.23.0 or default " , args [0 ])
388
389
return
389
390
}
390
391
f .Toolchain = & Toolchain {Syntax : line }
@@ -630,7 +631,7 @@ func (f *WorkFile) add(errs *ErrorList, line *Line, verb string, args []string,
630
631
errorf ("go directive expects exactly one argument" )
631
632
return
632
633
} else if ! GoVersionRE .MatchString (args [0 ]) {
633
- errorf ("invalid go version '%s': must match format 1.23" , args [0 ])
634
+ errorf ("invalid go version '%s': must match format 1.23.0 " , args [0 ])
634
635
return
635
636
}
636
637
@@ -646,7 +647,7 @@ func (f *WorkFile) add(errs *ErrorList, line *Line, verb string, args []string,
646
647
errorf ("toolchain directive expects exactly one argument" )
647
648
return
648
649
} else if ! ToolchainRE .MatchString (args [0 ]) {
649
- errorf ("invalid toolchain version '%s': must match format go1.23 or local " , args [0 ])
650
+ errorf ("invalid toolchain version '%s': must match format go1.23.0 or default " , args [0 ])
650
651
return
651
652
}
652
653
0 commit comments