1
0
mirror of https://github.com/netsampler/goflow2.git synced 2024-05-06 15:54:52 +00:00

format: fix renderer (#250)

This commit is contained in:
Louis
2023-12-06 13:37:51 +01:00
committed by GitHub
parent ac5e849a3b
commit e1c581e031

View File

@ -186,7 +186,10 @@ func FormatMessageReflectCustom(msg interface{}, ext, quotes, sep, sign string,
} }
fieldValue := vfm.FieldByName(fieldName) fieldValue := vfm.FieldByName(fieldName)
// todo: replace s by json mapping of protobuf // todo: replace s by json mapping of protobuf
if fieldValue.IsValid() { if renderer, ok := RenderExtras[fieldName]; ok {
fstr[i] = fmt.Sprintf("%s%s%s%s%q", quotes, s, quotes, sign, renderer(msg))
i++
} else if fieldValue.IsValid() {
if fieldType, ok := TextFields[fieldName]; ok { if fieldType, ok := TextFields[fieldName]; ok {
switch fieldType { switch fieldType {
@ -213,8 +216,6 @@ func FormatMessageReflectCustom(msg interface{}, ext, quotes, sep, sign string,
} }
} }
} else if renderer, ok := RenderExtras[fieldName]; ok {
fstr[i] = fmt.Sprintf("%s%s%s%s%q", quotes, s, quotes, sign, renderer(msg))
} else { } else {
// handle specific types here // handle specific types here
switch fieldValue.Kind() { switch fieldValue.Kind() {