(e *encodeState, v reflect.Value, opts encOpts)
| 443 | } |
| 444 | |
| 445 | func marshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) { |
| 446 | if v.Kind() == reflect.Ptr && v.IsNil() { |
| 447 | e.WriteString("null") |
| 448 | return |
| 449 | } |
| 450 | m, ok := v.Interface().(Marshaler) |
| 451 | if !ok { |
| 452 | e.WriteString("null") |
| 453 | return |
| 454 | } |
| 455 | b, err := m.MarshalJSON() |
| 456 | if err == nil { |
| 457 | // copy JSON into buffer, checking validity. |
| 458 | err = compact(&e.Buffer, b, opts.escapeHTML) |
| 459 | } |
| 460 | if err != nil { |
| 461 | e.error(&MarshalerError{v.Type(), err}) |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | func addrMarshalerEncoder(e *encodeState, v reflect.Value, _ encOpts) { |
| 466 | va := v.Addr() |
nothing calls this directly
no test coverage detected