Skip to content

Commit 02acd1a

Browse files
gen has diverged, so go more jank (#412)
Co-authored-by: lekko-app[bot] <108442683+lekko-app[bot]@users.noreply.github.com>
1 parent bd1bfb8 commit 02acd1a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pkg/gen/ts.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,26 @@ func FieldValueToTS(f protoreflect.FieldDescriptor, val protoreflect.Value) stri
482482
case protoreflect.EnumKind:
483483
fallthrough
484484
case protoreflect.StringKind:
485+
if f.IsList() {
486+
var results []string
487+
list := val.List()
488+
for i := 0; i < list.Len(); i++ {
489+
item := list.Get(i)
490+
results = append(results, fmt.Sprintf("%q", item.String()))
491+
}
492+
return "[" + strings.Join(results, ", ") + "]"
493+
}
485494
return fmt.Sprintf("%q", val.String())
486495
case protoreflect.BoolKind:
496+
if f.IsList() {
497+
var results []string
498+
list := val.List()
499+
for i := 0; i < list.Len(); i++ {
500+
item := list.Get(i)
501+
results = append(results, item.String())
502+
}
503+
return "[" + strings.Join(results, ", ") + "]"
504+
}
487505
return val.String()
488506
case protoreflect.BytesKind:
489507
panic("Don't know how to take bytes, try nibbles")
@@ -498,6 +516,15 @@ func FieldValueToTS(f protoreflect.FieldDescriptor, val protoreflect.Value) stri
498516
case protoreflect.Uint64Kind:
499517
fallthrough
500518
case protoreflect.Uint32Kind:
519+
if f.IsList() {
520+
var results []string
521+
list := val.List()
522+
for i := 0; i < list.Len(); i++ {
523+
item := list.Get(i)
524+
results = append(results, item.String())
525+
}
526+
return "[" + strings.Join(results, ", ") + "]"
527+
}
501528
return val.String()
502529
case protoreflect.MessageKind:
503530
if f.IsMap() {

0 commit comments

Comments
 (0)