Updating dependency github.com/google/go-cmp to version v0.4.0

This commit is contained in:
Davanum Srinivas
2020-03-24 13:19:44 -04:00
parent cccdf5cde6
commit 0dd6bf6258
73 changed files with 1088 additions and 96 deletions

View File

@@ -11,7 +11,7 @@ import (
"unsafe"
)
const supportAllowUnexported = true
const supportExporters = true
// retrieveUnexportedField uses unsafe to forcibly retrieve any field from
// a struct such that the value has read-write permissions.
@@ -19,5 +19,7 @@ const supportAllowUnexported = true
// The parent struct, v, must be addressable, while f must be a StructField
// describing the field to retrieve.
func retrieveUnexportedField(v reflect.Value, f reflect.StructField) reflect.Value {
return reflect.NewAt(f.Type, unsafe.Pointer(v.UnsafeAddr()+f.Offset)).Elem()
// See https://github.com/google/go-cmp/issues/167 for discussion of the
// following expression.
return reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem()
}