ioutil.ReadAll is deprecated, use io.ReadAll instead
29 }
30 defer resData.Body.Close()
31
32 bodyRes, err := ioutil.ReadAll(resData.Body)33 if err != nil {
34 fmt.Println("Error reading response data:", err)
35 return
Description
io/ioutil
package, like most things with util in the name, has turned out to
be a poorly defined and complex to understand the collection of things.
In a series of a few changes, the entire ioutil package will become deprecated starting from Go 1.16.
Existing code using ioutil will continue to work; ioutil will consist of simple wrappers to new functions which reside in the io and os packages.
Bad practice
ioutil.ReadAll(r)
ioutil.ReadFile(filename)
ioutil.ReadDir(dirname)
// ...
Recommended
io.ReadAll(r)
os.ReadFile(filename)
os.ReadDir(dirname)
// ...