mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
vendor: update copystructure/reflectwalk
This adds fixes that are needed for ResourceConfig copying, namely related to copying interfaces, avoiding unexported fields.
This commit is contained in:
parent
376f0827a3
commit
99e706b502
12
vendor/github.com/mitchellh/copystructure/copystructure.go
generated
vendored
12
vendor/github.com/mitchellh/copystructure/copystructure.go
generated
vendored
@ -295,12 +295,24 @@ func (w *walker) StructField(f reflect.StructField, v reflect.Value) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If PkgPath is non-empty, this is a private (unexported) field.
|
||||||
|
// We do not set this unexported since the Go runtime doesn't allow us.
|
||||||
|
if f.PkgPath != "" {
|
||||||
|
w.ignore()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Push the field onto the stack, we'll handle it when we exit
|
// Push the field onto the stack, we'll handle it when we exit
|
||||||
// the struct field in Exit...
|
// the struct field in Exit...
|
||||||
w.valPush(reflect.ValueOf(f))
|
w.valPush(reflect.ValueOf(f))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore causes the walker to ignore any more values until we exit this on
|
||||||
|
func (w *walker) ignore() {
|
||||||
|
w.ignoreDepth = w.depth
|
||||||
|
}
|
||||||
|
|
||||||
func (w *walker) ignoring() bool {
|
func (w *walker) ignoring() bool {
|
||||||
return w.ignoreDepth > 0 && w.depth >= w.ignoreDepth
|
return w.ignoreDepth > 0 && w.depth >= w.ignoreDepth
|
||||||
}
|
}
|
||||||
|
16
vendor/github.com/mitchellh/reflectwalk/reflectwalk.go
generated
vendored
16
vendor/github.com/mitchellh/reflectwalk/reflectwalk.go
generated
vendored
@ -4,9 +4,7 @@
|
|||||||
// those elements.
|
// those elements.
|
||||||
package reflectwalk
|
package reflectwalk
|
||||||
|
|
||||||
import (
|
import "reflect"
|
||||||
"reflect"
|
|
||||||
)
|
|
||||||
|
|
||||||
// PrimitiveWalker implementations are able to handle primitive values
|
// PrimitiveWalker implementations are able to handle primitive values
|
||||||
// within complex structures. Primitive values are numbers, strings,
|
// within complex structures. Primitive values are numbers, strings,
|
||||||
@ -145,6 +143,12 @@ func walkMap(v reflect.Value, w interface{}) error {
|
|||||||
for _, k := range v.MapKeys() {
|
for _, k := range v.MapKeys() {
|
||||||
kv := v.MapIndex(k)
|
kv := v.MapIndex(k)
|
||||||
|
|
||||||
|
// if the map value type is an interface, we need to extract the Elem
|
||||||
|
// for the next call to walk
|
||||||
|
if kv.Kind() == reflect.Interface {
|
||||||
|
kv = kv.Elem()
|
||||||
|
}
|
||||||
|
|
||||||
if mw, ok := w.(MapWalker); ok {
|
if mw, ok := w.(MapWalker); ok {
|
||||||
if err := mw.MapElem(v, k, kv); err != nil {
|
if err := mw.MapElem(v, k, kv); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -204,6 +208,12 @@ func walkSlice(v reflect.Value, w interface{}) (err error) {
|
|||||||
for i := 0; i < v.Len(); i++ {
|
for i := 0; i < v.Len(); i++ {
|
||||||
elem := v.Index(i)
|
elem := v.Index(i)
|
||||||
|
|
||||||
|
// if the value type is an interface, we need to extract the Elem
|
||||||
|
// for the next call to walk
|
||||||
|
if elem.Kind() == reflect.Interface {
|
||||||
|
elem = elem.Elem()
|
||||||
|
}
|
||||||
|
|
||||||
if sw, ok := w.(SliceWalker); ok {
|
if sw, ok := w.(SliceWalker); ok {
|
||||||
if err := sw.SliceElem(i, elem); err != nil {
|
if err := sw.SliceElem(i, elem); err != nil {
|
||||||
return err
|
return err
|
||||||
|
10
vendor/vendor.json
vendored
10
vendor/vendor.json
vendored
@ -1472,10 +1472,10 @@
|
|||||||
"revision": "8631ce90f28644f54aeedcb3e389a85174e067d1"
|
"revision": "8631ce90f28644f54aeedcb3e389a85174e067d1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "Vfkp+PcZ1wZ4+D6AsHTpKkdsQG0=",
|
"checksumSHA1": "EDAtec3XSbTjw6gWG+NNScows9M=",
|
||||||
"path": "github.com/mitchellh/copystructure",
|
"path": "github.com/mitchellh/copystructure",
|
||||||
"revision": "501dcbdc7c358c4d0bfa066018834bedca79fde3",
|
"revision": "8f3c396a26dadccbd29ee24c76c89166249cc16f",
|
||||||
"revisionTime": "2016-09-16T19:51:24Z"
|
"revisionTime": "2016-09-27T21:34:29Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "github.com/mitchellh/go-homedir",
|
"path": "github.com/mitchellh/go-homedir",
|
||||||
@ -1507,8 +1507,10 @@
|
|||||||
"revision": "6e6954073784f7ee67b28f2d22749d6479151ed7"
|
"revision": "6e6954073784f7ee67b28f2d22749d6479151ed7"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"checksumSHA1": "Qfbnn/PnYNR2ZHraUeHTxT4H7lM=",
|
||||||
"path": "github.com/mitchellh/reflectwalk",
|
"path": "github.com/mitchellh/reflectwalk",
|
||||||
"revision": "eecf4c70c626c7cfbb95c90195bc34d386c74ac6"
|
"revision": "2d53f44828cae4c770d745a3560e37d3356774a6",
|
||||||
|
"revisionTime": "2016-09-27T21:55:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "/iig5lYSPCL3C8J7e4nTAevYNDE=",
|
"checksumSHA1": "/iig5lYSPCL3C8J7e4nTAevYNDE=",
|
||||||
|
Loading…
Reference in New Issue
Block a user