6
6
"errors"
7
7
"fmt"
8
8
"io"
9
- "log"
10
9
"reflect"
11
10
"sort"
12
11
"strconv"
@@ -406,9 +405,7 @@ func TestUnmarshalNullableRelationshipsNonNullValue(t *testing.T) {
406
405
}
407
406
408
407
outBuf := bytes .NewBuffer (nil )
409
- if err := json .NewEncoder (outBuf ).Encode (payload ); err != nil {
410
- t .Fatalf ("failed to encode: %v" , err )
411
- }
408
+ json .NewEncoder (outBuf ).Encode (payload )
412
409
413
410
out := new (WithNullableAttrs )
414
411
@@ -445,9 +442,7 @@ func TestUnmarshalNullableRelationshipsExplicitNullValue(t *testing.T) {
445
442
}
446
443
447
444
outBuf := bytes .NewBuffer (nil )
448
- if err := json .NewEncoder (outBuf ).Encode (payload ); err != nil {
449
- t .Fatalf ("failed to encode: %v" , err )
450
- }
445
+ json .NewEncoder (outBuf ).Encode (payload )
451
446
452
447
out := new (WithNullableAttrs )
453
448
@@ -472,9 +467,7 @@ func TestUnmarshalNullableRelationshipsNonExistentValue(t *testing.T) {
472
467
}
473
468
474
469
outBuf := bytes .NewBuffer (nil )
475
- if err := json .NewEncoder (outBuf ).Encode (payload ); err != nil {
476
- t .Fatalf ("failed to encode: %v" , err )
477
- }
470
+ json .NewEncoder (outBuf ).Encode (payload )
478
471
479
472
out := new (WithNullableAttrs )
480
473
@@ -497,9 +490,7 @@ func TestUnmarshalNullableRelationshipsNoRelationships(t *testing.T) {
497
490
}
498
491
499
492
outBuf := bytes .NewBuffer (nil )
500
- if err := json .NewEncoder (outBuf ).Encode (payload ); err != nil {
501
- t .Fatalf ("failed to encode: %v" , err )
502
- }
493
+ json .NewEncoder (outBuf ).Encode (payload )
503
494
504
495
out := new (WithNullableAttrs )
505
496
@@ -1630,9 +1621,7 @@ func samplePayload() io.Reader {
1630
1621
}
1631
1622
1632
1623
out := bytes .NewBuffer (nil )
1633
- if err := json .NewEncoder (out ).Encode (payload ); err != nil {
1634
- log .Printf ("failed to encode: %v" , err )
1635
- }
1624
+ json .NewEncoder (out ).Encode (payload )
1636
1625
1637
1626
return out
1638
1627
}
@@ -1650,9 +1639,7 @@ func samplePayloadWithID() io.Reader {
1650
1639
}
1651
1640
1652
1641
out := bytes .NewBuffer (nil )
1653
- if err := json .NewEncoder (out ).Encode (payload ); err != nil {
1654
- log .Printf ("failed to encode: %v" , err )
1655
- }
1642
+ json .NewEncoder (out ).Encode (payload )
1656
1643
1657
1644
return out
1658
1645
}
@@ -1667,9 +1654,7 @@ func samplePayloadWithBadTypes(m map[string]interface{}) io.Reader {
1667
1654
}
1668
1655
1669
1656
out := bytes .NewBuffer (nil )
1670
- if err := json .NewEncoder (out ).Encode (payload ); err != nil {
1671
- log .Printf ("failed to encode: %v" , err )
1672
- }
1657
+ json .NewEncoder (out ).Encode (payload )
1673
1658
1674
1659
return out
1675
1660
}
@@ -1684,9 +1669,7 @@ func sampleWithPointerPayload(m map[string]interface{}) io.Reader {
1684
1669
}
1685
1670
1686
1671
out := bytes .NewBuffer (nil )
1687
- if err := json .NewEncoder (out ).Encode (payload ); err != nil {
1688
- log .Printf ("failed to encode: %v" , err )
1689
- }
1672
+ json .NewEncoder (out ).Encode (payload )
1690
1673
1691
1674
return out
1692
1675
}
@@ -1701,9 +1684,7 @@ func samplePayloadWithNullableAttrs(m map[string]interface{}) io.Reader {
1701
1684
}
1702
1685
1703
1686
out := bytes .NewBuffer (nil )
1704
- if err := json .NewEncoder (out ).Encode (payload ); err != nil {
1705
- log .Printf ("failed to encode: %v" , err )
1706
- }
1687
+ json .NewEncoder (out ).Encode (payload )
1707
1688
1708
1689
return out
1709
1690
}
@@ -1780,23 +1761,17 @@ func samplePayloadWithSideloaded() io.Reader {
1780
1761
testModel := testModel ()
1781
1762
1782
1763
out := bytes .NewBuffer (nil )
1783
- if err := MarshalPayload (out , testModel ); err != nil {
1784
- log .Printf ("failed to marshal payload: %v" , err )
1785
- }
1764
+ MarshalPayload (out , testModel )
1786
1765
1787
1766
return out
1788
1767
}
1789
1768
1790
1769
func sampleSerializedEmbeddedTestModel () * Blog {
1791
1770
out := bytes .NewBuffer (nil )
1792
- if err := MarshalOnePayloadEmbedded (out , testModel ()); err != nil {
1793
- log .Printf ("failed to marshal one payload embedded: %v" , err )
1794
- }
1771
+ MarshalOnePayloadEmbedded (out , testModel ())
1795
1772
1796
1773
blog := new (Blog )
1797
- if err := UnmarshalPayload (out , blog ); err != nil {
1798
- log .Printf ("failed to unmarshal payload: %v" , err )
1799
- }
1774
+ UnmarshalPayload (out , blog )
1800
1775
1801
1776
return blog
1802
1777
}
0 commit comments