We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f0e3a0d + f16e986 commit bc5cd1dCopy full SHA for bc5cd1d
hack/update/get_version/get_version.go
@@ -135,7 +135,15 @@ func main() {
135
if err != nil {
136
log.Fatalf("failed to read file: %v", err)
137
}
138
- submatches := re.FindSubmatch(data)
+
139
+ // this handles cases where multiple versions exist (e.g., old and new versions in go.mod)
140
+ allMatches := re.FindAllSubmatch(data, -1)
141
+ if len(allMatches) == 0 {
142
+ log.Fatalf("no matches found")
143
+ }
144
145
+ // Take the last match (most recent version)
146
+ submatches := allMatches[len(allMatches)-1]
147
if len(submatches) < 2 {
148
log.Fatalf("less than 2 submatches found")
149
0 commit comments