summaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-cmp/cmp/export.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/google/go-cmp/cmp/export.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/google/go-cmp/cmp/export.go')
-rw-r--r--vendor/github.com/google/go-cmp/cmp/export.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/vendor/github.com/google/go-cmp/cmp/export.go b/vendor/github.com/google/go-cmp/cmp/export.go
deleted file mode 100644
index 29f82fe6b..000000000
--- a/vendor/github.com/google/go-cmp/cmp/export.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2017, The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cmp
-
-import (
- "reflect"
- "unsafe"
-)
-
-// retrieveUnexportedField uses unsafe to forcibly retrieve any field from
-// a struct such that the value has read-write permissions.
-//
-// The parent struct, v, must be addressable, while f must be a StructField
-// describing the field to retrieve. If addr is false,
-// then the returned value will be shallowed copied to be non-addressable.
-func retrieveUnexportedField(v reflect.Value, f reflect.StructField, addr bool) reflect.Value {
- ve := reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem()
- if !addr {
- // A field is addressable if and only if the struct is addressable.
- // If the original parent value was not addressable, shallow copy the
- // value to make it non-addressable to avoid leaking an implementation
- // detail of how forcibly exporting a field works.
- if ve.Kind() == reflect.Interface && ve.IsNil() {
- return reflect.Zero(f.Type)
- }
- return reflect.ValueOf(ve.Interface()).Convert(f.Type)
- }
- return ve
-}