@@ -4,9 +4,10 @@ import (
4
4
"bytes"
5
5
"encoding/json"
6
6
"encoding/xml"
7
- "io/ioutil "
7
+ "io"
8
8
"net/http"
9
9
"net/http/cookiejar"
10
+ "os"
10
11
"reflect"
11
12
"strconv"
12
13
"strings"
@@ -84,7 +85,7 @@ func fetchAndPersistATCResults(resp *http.Response, details abaputils.Connection
84
85
// Parse response
85
86
var body []byte
86
87
if err == nil {
87
- body , err = ioutil .ReadAll (resp .Body )
88
+ body , err = io .ReadAll (resp .Body )
88
89
}
89
90
if err == nil {
90
91
defer resp .Body .Close ()
@@ -225,7 +226,7 @@ func logAndPersistAndEvaluateATCResults(utils piperutils.FileUtils, body []byte,
225
226
log .Entry ().Info ("There were no results from this run, most likely the checked Software Components are empty or contain no ATC findings" )
226
227
}
227
228
228
- err := ioutil .WriteFile (atcResultFileName , body , 0o644 )
229
+ err := os .WriteFile (atcResultFileName , body , 0o644 )
229
230
if err == nil {
230
231
log .Entry ().Infof ("Writing %s file was successful" , atcResultFileName )
231
232
var reports []piperutils.Path
@@ -242,7 +243,7 @@ func logAndPersistAndEvaluateATCResults(utils piperutils.FileUtils, body []byte,
242
243
htmlString := generateHTMLDocument (parsedXML )
243
244
htmlStringByte := []byte (htmlString )
244
245
atcResultHTMLFileName := strings .Trim (atcResultFileName , ".xml" ) + ".html"
245
- err = ioutil .WriteFile (atcResultHTMLFileName , htmlStringByte , 0o644 )
246
+ err = os .WriteFile (atcResultHTMLFileName , htmlStringByte , 0o644 )
246
247
if err == nil {
247
248
log .Entry ().Info ("Writing " + atcResultHTMLFileName + " file was successful" )
248
249
reports = append (reports , piperutils.Path {Target : atcResultFileName , Name : "ATC Results HTML file" , Mandatory : true })
@@ -317,7 +318,7 @@ func logResponseBody(resp *http.Response) error {
317
318
var bodyText []byte
318
319
var readError error
319
320
if resp != nil {
320
- bodyText , readError = ioutil .ReadAll (resp .Body )
321
+ bodyText , readError = io .ReadAll (resp .Body )
321
322
if readError != nil {
322
323
return readError
323
324
}
@@ -353,7 +354,7 @@ func pollATCRun(details abaputils.ConnectionDetailsHTTP, body []byte, client pip
353
354
if err != nil {
354
355
return "" , errors .Errorf ("Getting HTTP response failed: %v" , err )
355
356
}
356
- bodyText , err := ioutil .ReadAll (resp .Body )
357
+ bodyText , err := io .ReadAll (resp .Body )
357
358
if err != nil {
358
359
return "" , errors .Errorf ("Reading response body failed: %v" , err )
359
360
}
0 commit comments