@@ -52,12 +52,12 @@ import (
52
52
)
53
53
54
54
var ExampleValues = map [reflect.Type ]interface {}{
55
- reflect .TypeOf ( api .MinerSubsystem ( 0 ) ): api .MinerSubsystem (1 ),
56
- reflect .TypeOf ( auth .Permission ( "" )): auth .Permission ("write" ),
57
- reflect .TypeOf ( "" ): "string value" ,
58
- reflect .TypeOf ( uint64 ( 42 )): uint64 (42 ),
59
- reflect .TypeOf ( byte ( 7 ) ): byte (7 ),
60
- reflect .TypeOf ([ ]byte {}): []byte ("byte array" ),
55
+ reflect .TypeFor [ api.MinerSubsystem ]( ): api .MinerSubsystem (1 ),
56
+ reflect .TypeFor [ auth.Permission ](): auth .Permission ("write" ),
57
+ reflect .TypeFor [ string ](): "string value" ,
58
+ reflect .TypeFor [ uint64 ](): uint64 (42 ),
59
+ reflect .TypeFor [ byte ]( ): byte (7 ),
60
+ reflect .TypeFor [[ ]byte ](): []byte ("byte array" ),
61
61
}
62
62
63
63
func addExample (v interface {}) {
@@ -70,8 +70,8 @@ func init() {
70
70
panic (err )
71
71
}
72
72
73
- ExampleValues [reflect .TypeOf ( c )] = c
74
- ExampleValues [reflect .TypeOf ( & c )] = & c
73
+ ExampleValues [reflect .TypeFor [cid. Cid ]( )] = c
74
+ ExampleValues [reflect .TypeFor [ * cid. Cid ]( )] = & c
75
75
76
76
c2 , err := cid .Decode ("bafy2bzacebp3shtrn43k7g3unredz7fxn4gj533d3o43tqn2p2ipxxhrvchve" )
77
77
if err != nil {
@@ -80,15 +80,15 @@ func init() {
80
80
81
81
tsk := types .NewTipSetKey (c , c2 )
82
82
83
- ExampleValues [reflect .TypeOf ( tsk )] = tsk
83
+ ExampleValues [reflect .TypeFor [types. TipSetKey ]( )] = tsk
84
84
85
85
addr , err := address .NewIDAddress (1234 )
86
86
if err != nil {
87
87
panic (err )
88
88
}
89
89
90
- ExampleValues [reflect .TypeOf ( addr )] = addr
91
- ExampleValues [reflect .TypeOf ( & addr )] = & addr
90
+ ExampleValues [reflect .TypeFor [address. Address ]( )] = addr
91
+ ExampleValues [reflect .TypeFor [ * address. Address ]( )] = & addr
92
92
93
93
var ts types.TipSet
94
94
err = json .Unmarshal (tipsetSampleJson , & ts )
@@ -143,8 +143,7 @@ func init() {
143
143
addExample (& f3Cert )
144
144
145
145
block := blocks .Block (& blocks.BasicBlock {})
146
- ExampleValues [reflect .TypeOf (& block ).Elem ()] = block
147
-
146
+ ExampleValues [reflect .TypeFor [blocks.Block ]()] = block
148
147
addExample (bitfield .NewFromSet ([]uint64 {5 }))
149
148
addExample (abi .RegisteredSealProof_StackedDrg32GiBV1_1 )
150
149
addExample (abi .RegisteredPoStProof_StackedDrgWindow32GiBV1 )
@@ -187,9 +186,7 @@ func init() {
187
186
addExample (map [string ]int {"name" : 42 })
188
187
addExample (map [string ]time.Time {"name" : time .Unix (1615243938 , 0 ).UTC ()})
189
188
addExample (abi .ActorID (1000 ))
190
- addExample (map [string ]types.Actor {
191
- "t01236" : ExampleValue ("init" , reflect .TypeOf (types.Actor {}), nil ).(types.Actor ),
192
- })
189
+ addExample (map [string ]types.Actor {"t01236" : ExampleValue ("init" , reflect .TypeFor [types.Actor ](), nil ).(types.Actor )})
193
190
addExample (types .IpldOpGet )
194
191
addExample (& types.TraceIpld {
195
192
Op : types .IpldOpGet ,
0 commit comments