Skip to content

Commit 22eb03c

Browse files
author
Paddy Carver
committed
Make golangci-lint happy.
1 parent 6e9b9fc commit 22eb03c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

tfprotov5/tftypes/raw_value.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,24 +231,24 @@ func (r RawValue) Unmarshal(dst interface{}) error {
231231
}
232232

233233
func unmarshalUint64(in uint64, dst interface{}) error {
234-
switch dst.(type) {
234+
switch v := dst.(type) {
235235
case *uint64:
236-
*(dst.(*uint64)) = in
236+
*v = in
237237
case *uint32:
238238
if in > math.MaxUint32 {
239239
return fmt.Errorf("%d doesn't fit in %T", in, dst)
240240
}
241-
*(dst.(*uint32)) = uint32(in)
241+
*v = uint32(in)
242242
case *uint16:
243243
if in > math.MaxUint16 {
244244
return fmt.Errorf("%d doesn't fit in %T", in, dst)
245245
}
246-
*(dst.(*uint16)) = uint16(in)
246+
*v = uint16(in)
247247
case *uint8:
248248
if in > math.MaxUint8 {
249249
return fmt.Errorf("%d doesn't fit in %T", in, dst)
250250
}
251-
*(dst.(*uint8)) = uint8(in)
251+
*v = uint8(in)
252252
case *uint:
253253
// uint types are only guaranteed to be able to hold 32 bits;
254254
// anything more is dependent on the system. Because providers
@@ -258,41 +258,41 @@ func unmarshalUint64(in uint64, dst interface{}) error {
258258
if in > math.MaxUint32 {
259259
return fmt.Errorf("%d doesn't always fit in %T", in, dst)
260260
}
261-
*(dst.(*uint)) = uint(in)
261+
*v = uint(in)
262262
default:
263263
return fmt.Errorf("can't unmarshal uint64 into %T", dst)
264264
}
265265
return nil
266266
}
267267

268268
func unmarshalInt64(in int64, dst interface{}) error {
269-
switch dst.(type) {
269+
switch v := dst.(type) {
270270
case *int64:
271-
*(dst.(*int64)) = in
271+
*v = in
272272
case *int32:
273273
if in > math.MaxInt32 {
274274
return fmt.Errorf("%d doesn't fit in %T", in, dst)
275275
}
276276
if in < math.MinInt32 {
277277
return fmt.Errorf("%d doesn't fit in %T", in, dst)
278278
}
279-
*(dst.(*int32)) = int32(in)
279+
*v = int32(in)
280280
case *int16:
281281
if in > math.MaxInt16 {
282282
return fmt.Errorf("%d doesn't fit in %T", in, dst)
283283
}
284284
if in < math.MinInt16 {
285285
return fmt.Errorf("%d doesn't fit in %T", in, dst)
286286
}
287-
*(dst.(*int16)) = int16(in)
287+
*v = int16(in)
288288
case *int8:
289289
if in > math.MaxInt8 {
290290
return fmt.Errorf("%d doesn't fit in %T", in, dst)
291291
}
292292
if in < math.MinInt8 {
293293
return fmt.Errorf("%d doesn't fit in %T", in, dst)
294294
}
295-
*(dst.(*int8)) = int8(in)
295+
*v = int8(in)
296296
case *int:
297297
// int types are only guaranteed to be able to hold 32 bits;
298298
// anything more is dependent on the system. Because providers
@@ -305,25 +305,25 @@ func unmarshalInt64(in int64, dst interface{}) error {
305305
if in < math.MinInt32 {
306306
return fmt.Errorf("%d doesn't always fit in %T", in, dst)
307307
}
308-
*(dst.(*int)) = int(in)
308+
*v = int(in)
309309
default:
310310
return fmt.Errorf("can't unmarshal int64 into %T", dst)
311311
}
312312
return nil
313313
}
314314

315315
func unmarshalFloat64(in float64, dst interface{}) error {
316-
switch dst.(type) {
316+
switch v := dst.(type) {
317317
case *float64:
318-
*(dst.(*float64)) = in
318+
*v = in
319319
case *float32:
320320
if in > math.MaxFloat32 {
321321
return fmt.Errorf("%f doesn't fit in %T", in, dst)
322322
}
323323
if in < math.SmallestNonzeroFloat32 {
324324
return fmt.Errorf("%f doesn't fit in %T", in, dst)
325325
}
326-
*(dst.(*float32)) = float32(in)
326+
*v = float32(in)
327327
default:
328328
return fmt.Errorf("can't unmarshal float64 into %T", dst)
329329
}

0 commit comments

Comments
 (0)