feat: add the Document edit pipeline with comment-preserving write
Test / test (push) Successful in 1m35s

Assisted-by: GLM 5.3 Flash
This commit is contained in:
2026-09-22 01:22:46 +02:00
parent a7a942a8e1
commit 3ffae35a20
6 changed files with 488 additions and 23 deletions
+5 -2
View File
@@ -181,9 +181,12 @@ func (e *encoder) encode(v any) error {
if x == nil {
return fmt.Errorf("interpres: cannot marshal nil value")
}
return fmt.Errorf("interpres: cannot marshal a Document; marshal its Map() to write the values")
return e.writeDocument(x)
case Document:
return fmt.Errorf("interpres: cannot marshal a Document; marshal its Map() to write the values")
if x.root == nil {
return fmt.Errorf("interpres: cannot marshal nil value")
}
return e.writeDocument(&x)
case OrderedMap:
return e.encodeOrderedMap(&x)
case *OrderedMap: