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

@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"math/rand"
"net"
"net/url"
@ -144,7 +143,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
}
f.Close()
}
path, err := ioutil.TempDir("", "libpodlock")
path, err := os.MkdirTemp("", "libpodlock")
if err != nil {
fmt.Println(err)
os.Exit(1)
@ -875,7 +874,7 @@ func writeConf(conf []byte, confPath string) {
fmt.Println(err)
}
}
if err := ioutil.WriteFile(confPath, conf, 0o777); err != nil {
if err := os.WriteFile(confPath, conf, 0o777); err != nil {
fmt.Println(err)
}
}
@ -967,7 +966,7 @@ func (s *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers string, label string) string {
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile")
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
Expect(err).To(BeNil())
cmd := []string{"build", "--pull-never", "--layers=" + layers, "--file", dockerfilePath}
if label != "" {