MCPcopy
hub / github.com/google/go-cmp / comparePtr

Method comparePtr

cmp/compare.go:552–567  ·  cmp/compare.go::state.comparePtr
(t reflect.Type, vx, vy reflect.Value)

Source from the content-addressed store, hash-verified

550}
551
552func (s *state) comparePtr(t reflect.Type, vx, vy reflect.Value) {
553 if vx.IsNil() || vy.IsNil() {
554 s.report(vx.IsNil() && vy.IsNil(), 0)
555 return
556 }
557
558 // Cycle-detection for pointers.
559 if eq, visited := s.curPtrs.Push(vx, vy); visited {
560 s.report(eq, reportByCycle)
561 return
562 }
563 defer s.curPtrs.Pop(vx, vy)
564
565 vx, vy = vx.Elem(), vy.Elem()
566 s.compareAny(Indirect{&indirect{pathStep{t.Elem(), vx, vy}}})
567}
568
569func (s *state) compareInterface(t reflect.Type, vx, vy reflect.Value) {
570 if vx.IsNil() || vy.IsNil() {

Callers 1

compareAnyMethod · 0.95

Calls 5

reportMethod · 0.95
compareAnyMethod · 0.95
IsNilMethod · 0.80
PushMethod · 0.45
PopMethod · 0.45

Tested by

no test coverage detected