Skip to content

Commit

Permalink
Remove go1.9 only reflect functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
robshakir committed Sep 28, 2017
1 parent 78f31a5 commit 103f597
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ygot/struct_validation_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,10 @@ func copyMapField(dstField, srcField reflect.Value) error {
return fmt.Errorf("invalid map, got member type %s", k)
}

nm := reflect.MakeMapWithSize(reflect.MapOf((keys[0]).Type(), srcField.MapIndex(keys[0]).Type()), srcField.Len())
// TODO(robjs): When we move to go1.9+ only support in ygot, we can use the
// following to make a map of a particular size.
// nm := reflect.MakeMapWithSize(reflect.MapOf((keys[0]).Type(), srcField.MapIndex(keys[0]).Type()), srcField.Len())
nm := reflect.MakeMap(reflect.MapOf((keys[0]).Type(), srcField.MapIndex(keys[0]).Type()))
for _, k := range keys {
v := srcField.MapIndex(k)
d := reflect.New(v.Elem().Type())
Expand Down

0 comments on commit 103f597

Please sign in to comment.