diff --git a/.github/workflows/update_golang_version.yml b/.github/workflows/update_golang_version.yml index a1d2bdbcc97..f1f7bcbde8d 100644 --- a/.github/workflows/update_golang_version.yml +++ b/.github/workflows/update_golang_version.yml @@ -56,7 +56,7 @@ jobs: echo "bootstrap-version=${bootstrap_version}" >> $GITHUB_OUTPUT # Check if the PR already exists, if it does then do not create new PR. - gh pr list -S "is:open [${{ matrix.branch }}] Upgrade the Golang version to go${go_version}" > out.txt 2>&1 | true + gh pr list -S 'is:open "[${{ matrix.branch }}] Upgrade the Golang version to go${go_version}"' > out.txt 2>&1 | true if [ -s out.txt ]; then rm -f out.txt exit 0 diff --git a/go/tools/go-upgrade/go-upgrade.go b/go/tools/go-upgrade/go-upgrade.go index fed0632691b..b1376e5e2be 100644 --- a/go/tools/go-upgrade/go-upgrade.go +++ b/go/tools/go-upgrade/go-upgrade.go @@ -401,12 +401,12 @@ func replaceGoVersionInCodebase(old, new *version.Version) error { } } - if !isSameMajorMinorVersion(old, new) { + if !isSameVersion(old, new) { goModFiles := []string{"./go.mod"} for _, file := range goModFiles { err = replaceInFile( []*regexp.Regexp{regexp.MustCompile(regexpReplaceGoModGoVersion)}, - []string{fmt.Sprintf("go %d.%d", new.Segments()[0], new.Segments()[1])}, + []string{fmt.Sprintf("go %d.%d.%d", new.Segments()[0], new.Segments()[1], new.Segments()[2])}, file, ) if err != nil { @@ -502,6 +502,10 @@ func updateBootstrapChangelog(new string, goVersion *version.Version) error { return nil } +func isSameVersion(a, b *version.Version) bool { + return a.Segments()[0] == b.Segments()[0] && a.Segments()[1] == b.Segments()[1] && a.Segments()[2] == b.Segments()[2] +} + func isSameMajorMinorVersion(a, b *version.Version) bool { return a.Segments()[0] == b.Segments()[0] && a.Segments()[1] == b.Segments()[1] }