Replace deprecated ioutil

Package `io/ioutil` was deprecated in golang 1.16, preventing podman from
building under Fedora 37.  Fortunately, functionality identical
replacements are provided by the packages `io` and `os`.  Replace all
usage of all `io/ioutil` symbols with appropriate substitutions
according to the golang docs.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich
2022-09-20 09:59:28 -04:00
parent 30231d0da7
commit d968f3fe09
126 changed files with 347 additions and 452 deletions

View File

@@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"os"
"os/exec"
@@ -50,7 +49,7 @@ func main() {
}
func loadConfig(r io.Reader) (*rootlessport.Config, io.ReadCloser, io.WriteCloser, error) {
stdin, err := ioutil.ReadAll(r)
stdin, err := io.ReadAll(r)
if err != nil {
return nil, nil, nil, err
}
@@ -92,7 +91,7 @@ func parent() error {
}
// create the parent driver
stateDir, err := ioutil.TempDir(cfg.TmpDir, "rootlessport")
stateDir, err := os.MkdirTemp(cfg.TmpDir, "rootlessport")
if err != nil {
return err
}
@@ -240,7 +239,7 @@ outer:
// wait for ExitFD to be closed
logrus.Info("Waiting for exitfd to be closed")
if _, err := ioutil.ReadAll(exitR); err != nil {
if _, err := io.ReadAll(exitR); err != nil {
return err
}
return nil
@@ -357,7 +356,7 @@ func child() error {
}()
// wait for stdin to be closed
if _, err := ioutil.ReadAll(os.Stdin); err != nil {
if _, err := io.ReadAll(os.Stdin); err != nil {
return err
}
return nil