fix(encode): keep a []any of tables in the value-array form
Assisted-by: GLM 5.3
This commit is contained in:
@@ -388,6 +388,13 @@ func addArrayValue(doc *tomlDoc, name string, v reflect.Value, ctx string) error
|
||||
break
|
||||
}
|
||||
}
|
||||
// A []any of tables is what Parse produces for a value array of inline
|
||||
// tables; the [[header]] form would re-parse as []map[string]any and so
|
||||
// change the value's Go type across a round-trip. The header form is
|
||||
// reserved for typed table slices.
|
||||
if v.Type().Elem().Kind() == reflect.Interface {
|
||||
allTables = false
|
||||
}
|
||||
if allTables {
|
||||
subs := make([]*tomlDoc, n)
|
||||
for i := range n {
|
||||
|
||||
Reference in New Issue
Block a user