Flat CVs: represent null as "null", not "<nil>"

This commit is contained in:
Alexander A. Klimov 2021-04-19 16:43:58 +02:00
parent da030805b5
commit 188ce4cb4b

View file

@ -58,7 +58,13 @@ func FlattenCustomvars(ctx context.Context, cvs <-chan contracts.Entity) (<-chan
flattened := flatten.Flatten(value, customvar.Name)
for flatname, flatvalue := range flattened {
flatvalue := fmt.Sprintf("%v", flatvalue)
var fv string
if flatvalue == nil {
fv = "null"
} else {
fv = fmt.Sprintf("%v", flatvalue)
}
select {
case cvFlats <- &CustomvarFlat{
CustomvarMeta: CustomvarMeta{
@ -76,7 +82,7 @@ func FlattenCustomvars(ctx context.Context, cvs <-chan contracts.Entity) (<-chan
},
Flatname: flatname,
FlatnameChecksum: utils.Checksum(flatname),
Flatvalue: flatvalue,
Flatvalue: fv,
}:
case <-ctx.Done():
return ctx.Err()