Merge pull request #7979 from hashicorp/jbardin/copystructure

update github.com/mitchellh/copystructure
This commit is contained in:
James Bardin 2016-08-04 16:33:05 -04:00 committed by GitHub
commit 9b4a6ee71d
2 changed files with 8 additions and 8 deletions

View File

@ -95,7 +95,9 @@ func (w *walker) Exit(l reflectwalk.Location) error {
if v.IsValid() {
s := w.cs[len(w.cs)-1]
sf := reflect.Indirect(s).FieldByName(f.Name)
sf.Set(v)
if sf.CanSet() {
sf.Set(v)
}
}
case reflectwalk.WalkLoc:
// Clear out the slices for GC
@ -111,16 +113,12 @@ func (w *walker) Map(m reflect.Value) error {
return nil
}
// Get the type for the map
t := m.Type()
mapType := reflect.MapOf(t.Key(), t.Elem())
// Create the map. If the map itself is nil, then just make a nil map
var newMap reflect.Value
if m.IsNil() {
newMap = reflect.Indirect(reflect.New(mapType))
newMap = reflect.Indirect(reflect.New(m.Type()))
} else {
newMap = reflect.MakeMap(reflect.MapOf(t.Key(), t.Elem()))
newMap = reflect.MakeMap(m.Type())
}
w.cs = append(w.cs, newMap)

4
vendor/vendor.json vendored
View File

@ -1410,8 +1410,10 @@
"revision": "8631ce90f28644f54aeedcb3e389a85174e067d1"
},
{
"checksumSHA1": "86nE93o1VIND0Doe8PuhCXnhUx0=",
"path": "github.com/mitchellh/copystructure",
"revision": "80adcec1955ee4e97af357c30dee61aadcc02c10"
"revision": "cdac8253d00f2ecf0a0b19fbff173a9a72de4f82",
"revisionTime": "2016-08-04T03:23:30Z"
},
{
"path": "github.com/mitchellh/go-homedir",