parser: Indent TOML tables

Fixes #8850
This commit is contained in:
Bjørn Erik Pedersen
2021-08-04 11:33:30 +02:00
parent d6c8cd7718
commit 9bba9a3a98
2 changed files with 82 additions and 82 deletions

View File

@@ -46,7 +46,9 @@ func InterfaceToConfig(in interface{}, format metadecoders.Format, w io.Writer)
return err
case metadecoders.TOML:
return toml.NewEncoder(w).Encode(in)
enc := toml.NewEncoder(w)
enc.SetIndentTables(true)
return enc.Encode(in)
case metadecoders.JSON:
b, err := json.MarshalIndent(in, "", " ")
if err != nil {