From f6066592a63bc1e26cb29a27c3c7833e713c6a4f Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Tue, 17 Oct 2023 08:29:24 +0200 Subject: [PATCH] tools/update-go-azure-sdk: skipping the import path if it's not for this service --- internal/tools/update-go-azure-sdk/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/tools/update-go-azure-sdk/main.go b/internal/tools/update-go-azure-sdk/main.go index d7a19fd3e347..0a7564212edf 100644 --- a/internal/tools/update-go-azure-sdk/main.go +++ b/internal/tools/update-go-azure-sdk/main.go @@ -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{}{} }