Skip to content

Commit 8dd7602

Browse files
authored
Merge pull request #14234 from github/mbg/go/1.21-update-version-regex
Go: Update `versionRe` to include patch version
2 parents 264e57f + d7278be commit 8dd7602

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

go/extractor/cli/go-autobuilder/go-autobuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ func getDepMode(emitDiagnostics bool) (DependencyInstallerMode, string) {
370370
// Tries to open `go.mod` and read a go directive, returning the version and whether it was found.
371371
func tryReadGoDirective(buildInfo BuildInfo) (string, bool) {
372372
if buildInfo.DepMode == GoGetWithModules {
373-
versionRe := regexp.MustCompile(`(?m)^go[ \t\r]+([0-9]+\.[0-9]+)$`)
373+
versionRe := regexp.MustCompile(`(?m)^go[ \t\r]+([0-9]+\.[0-9]+(\.[0-9]+)?)$`)
374374
goMod, err := os.ReadFile(filepath.Join(buildInfo.BaseDir, "go.mod"))
375375
if err != nil {
376376
log.Println("Failed to read go.mod to check for missing Go version")

0 commit comments

Comments
 (0)