@@ -28,11 +28,13 @@ import (
28
28
// given type
29
29
// e.g. turn
30
30
// var fields []reflect.StructField
31
- // fields = append(fields, reflect.StructField{
32
- // Name: "X",
33
- // Type: reflect.TypeOf(new(big.Int)),
34
- // Tag: reflect.StructTag("json:\"" + "x" + "\""),
35
- // }
31
+ //
32
+ // fields = append(fields, reflect.StructField{
33
+ // Name: "X",
34
+ // Type: reflect.TypeOf(new(big.Int)),
35
+ // Tag: reflect.StructTag("json:\"" + "x" + "\""),
36
+ // }
37
+ //
36
38
// into
37
39
// type TupleT struct { X *big.Int }
38
40
func ConvertType (in interface {}, proto interface {}) interface {} {
@@ -123,22 +125,15 @@ func set(dst, src reflect.Value) error {
123
125
func setSlice (dst , src reflect.Value ) error {
124
126
slice := reflect .MakeSlice (dst .Type (), src .Len (), src .Len ())
125
127
for i := 0 ; i < src .Len (); i ++ {
126
- if src .Index (i ).Kind () == reflect .Struct {
127
- if err := set (slice .Index (i ), src .Index (i )); err != nil {
128
- return err
129
- }
130
- } else {
131
- // e.g. [][32]uint8 to []common.Hash
132
- if err := set (slice .Index (i ), src .Index (i )); err != nil {
133
- return err
134
- }
128
+ if err := set (slice .Index (i ), src .Index (i )); err != nil {
129
+ return err
135
130
}
136
131
}
137
132
if dst .CanSet () {
138
133
dst .Set (slice )
139
134
return nil
140
135
}
141
- return errors .New ("Cannot set slice, destination not settable" )
136
+ return errors .New ("cannot set slice, destination not settable" )
142
137
}
143
138
144
139
func setArray (dst , src reflect.Value ) error {
0 commit comments