feat: parse into a Document that keeps order and comments
Test / test (push) Successful in 1m34s

Assisted-by: DeepSeek V4.1 Flash
This commit is contained in:
2026-09-20 10:40:57 +02:00
parent a6e3e3fe31
commit 72f8b21ac4
16 changed files with 939 additions and 119 deletions
+9
View File
@@ -86,6 +86,15 @@ func (e *encoder) encode(v any) error {
if err := e.checkCtx(); err != nil {
return err
}
switch x := v.(type) {
case *Document:
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")
case Document:
return fmt.Errorf("interpres: cannot marshal a Document; marshal its Map() to write the values")
}
rv := reflect.ValueOf(v)
if !rv.IsValid() {
return fmt.Errorf("interpres: cannot marshal nil value")