Use a single line for slice encoding (#119)
This commit is contained in:
committed by
Thomas Pelletier
parent
ce7be745f0
commit
017119f7a7
@@ -79,11 +79,11 @@ func toTomlValue(item interface{}, indent int) string {
|
||||
case time.Time:
|
||||
return tab + value.Format(time.RFC3339)
|
||||
case []interface{}:
|
||||
result := tab + "[\n"
|
||||
values := []string{}
|
||||
for _, item := range value {
|
||||
result += toTomlValue(item, indent+2) + ",\n"
|
||||
values = append(values, toTomlValue(item, 0))
|
||||
}
|
||||
return result + tab + "]"
|
||||
return "[" + strings.Join(values, ",") + "]"
|
||||
case nil:
|
||||
return ""
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user