fix(encode): keep a []any of tables in the value-array form

Assisted-by: GLM 5.3
This commit is contained in:
2026-09-17 23:10:35 +02:00
parent c485aab227
commit d5327568fb
5 changed files with 48 additions and 0 deletions
+7
View File
@@ -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 {