Skip to content

Commit

Permalink
- fixes a bug where package name could contain invalid characters in go
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Oct 25, 2021
1 parent 6def10e commit 6d5af92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public CodeClassDeclarationWriter(GoConventionService conventionService) : base(
public override void WriteCodeElement(CodeClass.Declaration codeElement, LanguageWriter writer)
{
if(codeElement?.Parent?.Parent is CodeNamespace ns)
writer.WriteLine($"package {ns.Name.GetLastNamespaceSegment()}");
writer.WriteLine($"package {ns.Name.GetLastNamespaceSegment().Replace("-", string.Empty)}");
var importSegments = codeElement
.Usings
.Where(x => !x.Declaration.IsExternal)
Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public CodeEnumWriter(GoConventionService conventionService) : base(conventionSe
public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter writer) {
if(!codeElement.Options.Any()) return;
if(codeElement?.Parent is CodeNamespace ns)
writer.WriteLine($"package {ns.Name.GetLastNamespaceSegment()}");
writer.WriteLine($"package {ns.Name.GetLastNamespaceSegment().Replace("-", string.Empty)}");

writer.WriteLine("import (");
writer.IncreaseIndent();
Expand Down

0 comments on commit 6d5af92

Please sign in to comment.