MCPcopy Create free account
hub / github.com/expr-lang/expr / samePointers

Function samePointers

internal/testify/assert/assertions.go:533–546  ·  view source on GitHub ↗

samePointers compares two generic interface objects and returns whether they point to the same object

(first, second interface{})

Source from the content-addressed store, hash-verified

531// samePointers compares two generic interface objects and returns whether
532// they point to the same object
533func samePointers(first, second interface{}) bool {
534 firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second)
535 if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr {
536 return false
537 }
538
539 firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second)
540 if firstType != secondType {
541 return false
542 }
543
544 // compare pointer addresses
545 return first == second
546}
547
548// formatUnequalValues takes two values of arbitrary types and returns string
549// representations appropriate to be presented to the user.

Callers 3

Test_samePointersFunction · 0.85
SameFunction · 0.85
NotSameFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_samePointersFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…