summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2022-09-20 09:59:28 -0400
committerChris Evich <cevich@redhat.com>2022-09-20 15:34:27 -0400
commitd968f3fe09a4c7d74464cfe2eaa9e4febbe61ba5 (patch)
treeedc3b78d1565b5df8074c0cf47c1d1cf1126a97a /pkg/specgen
parent30231d0da7e6dcf3d6d1f45b10150baae35aaf28 (diff)
downloadpodman-d968f3fe09a4c7d74464cfe2eaa9e4febbe61ba5.tar.gz
podman-d968f3fe09a4c7d74464cfe2eaa9e4febbe61ba5.tar.bz2
podman-d968f3fe09a4c7d74464cfe2eaa9e4febbe61ba5.zip
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>
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/config_linux_cgo.go4
-rw-r--r--pkg/specgen/generate/pause_image.go3
-rw-r--r--pkg/specgen/generate/validate.go3
3 files changed, 4 insertions, 6 deletions
diff --git a/pkg/specgen/generate/config_linux_cgo.go b/pkg/specgen/generate/config_linux_cgo.go
index 74ba4aeeb..6903ccb51 100644
--- a/pkg/specgen/generate/config_linux_cgo.go
+++ b/pkg/specgen/generate/config_linux_cgo.go
@@ -7,7 +7,7 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
+ "os"
"github.com/containers/common/libimage"
goSeccomp "github.com/containers/common/pkg/seccomp"
@@ -47,7 +47,7 @@ func getSeccompConfig(s *specgen.SpecGenerator, configSpec *spec.Spec, img *libi
if s.SeccompProfilePath != "" {
logrus.Debugf("Loading seccomp profile from %q", s.SeccompProfilePath)
- seccompProfile, err := ioutil.ReadFile(s.SeccompProfilePath)
+ seccompProfile, err := os.ReadFile(s.SeccompProfilePath)
if err != nil {
return nil, fmt.Errorf("opening seccomp profile failed: %w", err)
}
diff --git a/pkg/specgen/generate/pause_image.go b/pkg/specgen/generate/pause_image.go
index ddf35f230..1b502927f 100644
--- a/pkg/specgen/generate/pause_image.go
+++ b/pkg/specgen/generate/pause_image.go
@@ -3,7 +3,6 @@ package generate
import (
"context"
"fmt"
- "io/ioutil"
"os"
buildahDefine "github.com/containers/buildah/define"
@@ -62,7 +61,7 @@ func buildPauseImage(rt *libpod.Runtime, rtConfig *config.Config) (string, error
COPY %s /catatonit
ENTRYPOINT ["/catatonit", "-P"]`, catatonitPath)
- tmpF, err := ioutil.TempFile("", "pause.containerfile")
+ tmpF, err := os.CreateTemp("", "pause.containerfile")
if err != nil {
return "", err
}
diff --git a/pkg/specgen/generate/validate.go b/pkg/specgen/generate/validate.go
index e9ebdfce3..10997a202 100644
--- a/pkg/specgen/generate/validate.go
+++ b/pkg/specgen/generate/validate.go
@@ -3,7 +3,6 @@ package generate
import (
"errors"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
@@ -180,7 +179,7 @@ func verifyContainerResourcesCgroupV2(s *specgen.SpecGenerator) ([]string, error
// If running under the root cgroup try to create or reuse a "probe" cgroup to read memory values
own = "podman_probe"
_ = os.MkdirAll(filepath.Join("/sys/fs/cgroup", own), 0o755)
- _ = ioutil.WriteFile("/sys/fs/cgroup/cgroup.subtree_control", []byte("+memory"), 0o644)
+ _ = os.WriteFile("/sys/fs/cgroup/cgroup.subtree_control", []byte("+memory"), 0o644)
}
memoryMax := filepath.Join("/sys/fs/cgroup", own, "memory.max")