Skip to content

Commit

Permalink
tools/update-go-azure-sdk: skipping the import path if it's not for t…
Browse files Browse the repository at this point in the history
…his service
  • Loading branch information
tombuildsstuff committed Oct 17, 2023
1 parent 7270506 commit f606659
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/tools/update-go-azure-sdk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,19 @@ func determineApiVersionsCurrentlyUsedForService(workingDirectory string, servic
}
line = strings.TrimSpace(components[1])
}
serviceImportPath := fmt.Sprintf("github.com/hashicorp/go-azure-sdk/resource-manager/%s/", serviceName)
if !strings.Contains(line, serviceImportPath) {
logger.Trace(fmt.Sprintf("Skipping line %q since it's not for this SDK..", line))
continue
}

// pull out the api version, which is predictable
line = strings.TrimPrefix(line, `"`)
line = strings.TrimPrefix(line, fmt.Sprintf("github.com/hashicorp/go-azure-sdk/resource-manager/%s/", serviceName))
line = strings.TrimPrefix(line, serviceImportPath)
line = strings.TrimSuffix(line, `"`)
components := strings.Split(line, "/")
apiVersion := components[0]
logger.Trace(fmt.Sprintf("Found API Version %q from %q", apiVersion, line))
apiVersions[apiVersion] = struct{}{}
}

Expand Down

0 comments on commit f606659

Please sign in to comment.