@@ -2,7 +2,6 @@ package list
22
33import (
44 "encoding/json"
5- "io/ioutil"
65 "os"
76 "reflect"
87 "strings"
@@ -13,9 +12,14 @@ import (
1312
1413// Helper function to read issues from a file.
1514func ReadIssues (path string ) []issues.Issue {
16- raw , _ := ioutil .ReadFile (path )
15+ raw , err := os .ReadFile (path )
16+ if err != nil {
17+ panic (err )
18+ }
1719 var fetchedIssues []issues.Issue
18- _ = json .Unmarshal (raw , & fetchedIssues )
20+ if err := json .Unmarshal (raw , & fetchedIssues ); err != nil {
21+ panic (err )
22+ }
1923
2024 return fetchedIssues
2125}
@@ -26,8 +30,14 @@ func TestListCSV(t *testing.T) {
2630 opts .exportCSV ("./testdata/exported.csv" )
2731
2832 // read exported and test CSV files
29- exported , _ := ioutil .ReadFile ("./testdata/exported.csv" )
30- test , _ := ioutil .ReadFile ("./testdata/csv/test.csv" )
33+ exported , err := os .ReadFile ("./testdata/exported.csv" )
34+ if err != nil {
35+ t .Fatal (err )
36+ }
37+ test , err := os .ReadFile ("./testdata/csv/test.csv" )
38+ if err != nil {
39+ t .Fatal (err )
40+ }
3141
3242 // trim carriage returns
3343 got := strings .TrimSuffix (string (exported ), "\n " )
@@ -47,8 +57,14 @@ func TestListJSON(t *testing.T) {
4757 opts .exportJSON ("./testdata/exported.json" )
4858
4959 // read exported and test JSON files
50- exported , _ := ioutil .ReadFile ("./testdata/exported.json" )
51- test , _ := ioutil .ReadFile ("./testdata/json/test.json" )
60+ exported , err := os .ReadFile ("./testdata/exported.json" )
61+ if err != nil {
62+ t .Fatal (err )
63+ }
64+ test , err := os .ReadFile ("./testdata/json/test.json" )
65+ if err != nil {
66+ t .Fatal (err )
67+ }
5268
5369 // trim carriage returns
5470 got := strings .TrimSuffix (string (exported ), "\n " )
@@ -71,8 +87,8 @@ func TestListSARIF(t *testing.T) {
7187 opts .exportSARIF ("./testdata/exported.sarif" )
7288
7389 // read exported and test SARIF files
74- exported , _ := ioutil .ReadFile ("./testdata/exported.sarif" )
75- test , _ := ioutil .ReadFile ("./testdata/sarif/test.sarif" )
90+ exported , _ := os .ReadFile ("./testdata/exported.sarif" )
91+ test , _ := os .ReadFile ("./testdata/sarif/test.sarif" )
7692
7793 // trim carriage returns
7894 got := strings .TrimSuffix (string (exported ), "\n " )
@@ -94,8 +110,8 @@ func TestListSARIF(t *testing.T) {
94110 opts .exportSARIF ("./testdata/exported_multi.sarif" )
95111
96112 // read exported and test SARIF files
97- exported , _ := ioutil .ReadFile ("./testdata/exported_multi.sarif" )
98- test , _ := ioutil .ReadFile ("./testdata/sarif/test_multi.sarif" )
113+ exported , _ := os .ReadFile ("./testdata/exported_multi.sarif" )
114+ test , _ := os .ReadFile ("./testdata/sarif/test_multi.sarif" )
99115
100116 // trim carriage returns
101117 got := strings .TrimSuffix (string (exported ), "\n " )
0 commit comments