Skip to content

Commit cf2a514

Browse files
authored
fix: current api-version fetch (Azure#17699)
1 parent 5b954c1 commit cf2a514

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

eng/tools/generator/cmd/v2/common/changlogProcessor.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,11 @@ func GetCurrentAPIVersion(packagePath string) (string, error) {
6767

6868
lines := strings.Split(string(b), "\n")
6969
for _, line := range lines {
70-
if strings.Contains(line, "api-version") {
71-
return strings.Split(line, "\"")[3], nil
70+
if strings.Contains(line, "\"api-version\"") {
71+
parts := strings.Split(line, "\"")
72+
if len(parts) == 5 {
73+
return parts[3], nil
74+
}
7275
}
7376
}
7477
}

0 commit comments

Comments
 (0)