Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
rkodev committed Feb 5, 2024
1 parent 7c378b1 commit e9b8a0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write
"const (");
writer.IncreaseIndent();
var isMultiValue = codeElement.Flags;

var iotaSuffix = $" {typeName} = iota";
var enumOptions = codeElement.Options;
int power = 0;
foreach (var item in enumOptions)
{
if (!string.IsNullOrEmpty(item.Documentation.Description))
writer.WriteLine($"// {item.Documentation.Description}");

if (isMultiValue)
writer.WriteLine($"{item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()} = {(int)Math.Pow(2, power)}");
else
else
writer.WriteLine($"{item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()}{iotaSuffix}");

if (!string.IsNullOrEmpty(iotaSuffix))
iotaSuffix = string.Empty;

Expand Down Expand Up @@ -70,7 +70,7 @@ private void WriteStringFunction(CodeEnum codeElement, LanguageWriter writer, Bo
.Select(x => $"\"{x.WireName}\"")
.Aggregate((x, y) => x + ", " + y);
writer.WriteLine($"options := []string{{{literalOptions}}}");
writer.StartBlock($"for p := 0; p < { enumOptions.Count }; p++ {{");
writer.StartBlock($"for p := 0; p < {enumOptions.Count}; p++ {{");
writer.WriteLine($"mantis := {typeName}(int(math.Pow(2, float64(p))))");
writer.StartBlock($"if i&mantis == mantis {{");
writer.WriteLine($"values = append(values, options[p])");
Expand Down

0 comments on commit e9b8a0d

Please sign in to comment.