diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 96d47d236e..113d1399c7 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -768,7 +768,13 @@ private void NormalizeNamespaceNames(CodeElement currentElement) if (namespaceName.StartsWith(clientNamespace, StringComparison.OrdinalIgnoreCase) && !namespaceName.Equals(clientNamespace, StringComparison.OrdinalIgnoreCase)) { var secondPart = namespaceName[clientNamespace.Length..]; // The rest of the name after the clientNamespace - codeNamespace.Name = $"{clientNamespace}.{secondPart.ToLowerInvariant()}"; + var withEmptyRemoved = string.Join('.', secondPart.Split('.', StringSplitOptions.RemoveEmptyEntries)); + var normalizedString = string.IsNullOrEmpty(withEmptyRemoved) switch + { + true => string.Empty, + false => $".{withEmptyRemoved}" + }; + codeNamespace.Name = $"{clientNamespace}{normalizedString.ToLowerInvariant()}"; } } CrawlTree(currentElement, NormalizeNamespaceNames);