Skip to content

Commit

Permalink
use legacy functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tigh-latte committed May 13, 2024
1 parent 8eda55b commit 98b9046
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ func (e *encoder) getMapKey(key reflect.Value, namespace []byte) (string, bool)

func (e *encoder) marshal(namespace []byte, v reflect.Value, idx int) (bool, error) {
t := v.Type()
if t.Kind() != reflect.Pointer && v.CanAddr() && reflect.PointerTo(t).Implements(marshalerType) {
if t.Kind() != reflect.Ptr && v.CanAddr() && reflect.PtrTo(t).Implements(marshalerType) {
return e.marshalAddr(namespace, v, idx)
}
if !t.Implements(marshalerType) && !reflect.PointerTo(t).Implements(marshalerType) {
if !t.Implements(marshalerType) && !reflect.PtrTo(t).Implements(marshalerType) {
return false, nil
}
if t.Kind() == reflect.Pointer && v.IsNil() {
if t.Kind() == reflect.Ptr && v.IsNil() {
return false, nil
}
um := v.Interface().(Marshaler)
Expand Down

0 comments on commit 98b9046

Please sign in to comment.