Handle ioutil deprecations (#53526)

* replace ioutil.ReadFile -> os.ReadFile

* replace ioutil.ReadAll -> io.ReadAll

* replace ioutil.TempFile -> os.CreateTemp

* replace ioutil.NopCloser -> io.NopCloser

* replace ioutil.WriteFile -> os.WriteFile

* replace ioutil.TempDir -> os.MkdirTemp

* replace ioutil.Discard -> io.Discard
This commit is contained in:
Jo
2022-08-10 15:37:51 +02:00
committed by GitHub
parent 4926767737
commit 062d255124
140 changed files with 462 additions and 492 deletions
@@ -2,7 +2,7 @@ package main
import (
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
"time"
@@ -62,7 +62,7 @@ func (getHTTPContents) getContents(url string) (string, error) {
}
defer response.Body.Close()
all, err := ioutil.ReadAll(response.Body)
all, err := io.ReadAll(response.Body)
if err != nil {
return "", err
}
+2 -2
View File
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"strings"
@@ -276,7 +276,7 @@ func (p *publisher) postRequest(url string, obj interface{}, desc string) error
if res.Body != nil {
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return err
}