summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
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/domain/infra
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/domain/infra')
-rw-r--r--pkg/domain/infra/abi/images.go5
-rw-r--r--pkg/domain/infra/abi/play.go7
-rw-r--r--pkg/domain/infra/abi/secrets.go3
-rw-r--r--pkg/domain/infra/abi/trust.go4
-rw-r--r--pkg/domain/infra/tunnel/images.go3
5 files changed, 9 insertions, 13 deletions
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go
index 6934de60e..9ea09e1ec 100644
--- a/pkg/domain/infra/abi/images.go
+++ b/pkg/domain/infra/abi/images.go
@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io/fs"
- "io/ioutil"
"net/url"
"os"
"os/exec"
@@ -340,7 +339,7 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
return err
}
- if err := ioutil.WriteFile(options.DigestFile, []byte(manifestDigest.String()), 0644); err != nil {
+ if err := os.WriteFile(options.DigestFile, []byte(manifestDigest.String()), 0644); err != nil {
return err
}
}
@@ -910,5 +909,5 @@ func putSignature(manifestBlob []byte, mech signature.SigningMechanism, sigStore
if err != nil {
return err
}
- return ioutil.WriteFile(filepath.Join(signatureDir, sigFilename), newSig, 0644)
+ return os.WriteFile(filepath.Join(signatureDir, sigFilename), newSig, 0644)
}
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index d447b4d00..847e81e69 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -116,7 +115,7 @@ func (ic *ContainerEngine) PlayKube(ctx context.Context, body io.Reader, options
validKinds := 0
// read yaml document
- content, err := ioutil.ReadAll(body)
+ content, err := io.ReadAll(body)
if err != nil {
return nil, err
}
@@ -873,7 +872,7 @@ func (ic *ContainerEngine) playKubePVC(ctx context.Context, pvcYAML *v1.Persiste
func readConfigMapFromFile(r io.Reader) (v1.ConfigMap, error) {
var cm v1.ConfigMap
- content, err := ioutil.ReadAll(r)
+ content, err := io.ReadAll(r)
if err != nil {
return cm, fmt.Errorf("unable to read ConfigMap YAML content: %w", err)
}
@@ -1005,7 +1004,7 @@ func (ic *ContainerEngine) PlayKubeDown(ctx context.Context, body io.Reader, _ e
reports := new(entities.PlayKubeReport)
// read yaml document
- content, err := ioutil.ReadAll(body)
+ content, err := io.ReadAll(body)
if err != nil {
return nil, err
}
diff --git a/pkg/domain/infra/abi/secrets.go b/pkg/domain/infra/abi/secrets.go
index 47159d65a..4867cbe1c 100644
--- a/pkg/domain/infra/abi/secrets.go
+++ b/pkg/domain/infra/abi/secrets.go
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
- "io/ioutil"
"path/filepath"
"strings"
@@ -14,7 +13,7 @@ import (
)
func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader io.Reader, options entities.SecretCreateOptions) (*entities.SecretCreateReport, error) {
- data, _ := ioutil.ReadAll(reader)
+ data, _ := io.ReadAll(reader)
secretsPath := ic.Libpod.GetSecretsStorageDir()
manager, err := ic.Libpod.SecretsManager()
if err != nil {
diff --git a/pkg/domain/infra/abi/trust.go b/pkg/domain/infra/abi/trust.go
index c58ddff06..9b30920d7 100644
--- a/pkg/domain/infra/abi/trust.go
+++ b/pkg/domain/infra/abi/trust.go
@@ -3,7 +3,7 @@ package abi
import (
"context"
"fmt"
- "io/ioutil"
+ "os"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/trust"
@@ -18,7 +18,7 @@ func (ir *ImageEngine) ShowTrust(ctx context.Context, args []string, options ent
if len(options.PolicyPath) > 0 {
policyPath = options.PolicyPath
}
- report.Raw, err = ioutil.ReadFile(policyPath)
+ report.Raw, err = os.ReadFile(policyPath)
if err != nil {
return nil, err
}
diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go
index cc99b1b3a..9ae1ff959 100644
--- a/pkg/domain/infra/tunnel/images.go
+++ b/pkg/domain/infra/tunnel/images.go
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
"os"
"strconv"
"strings"
@@ -264,7 +263,7 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string,
switch opts.Format {
case "oci-dir", "docker-dir":
- f, err = ioutil.TempFile("", "podman_save")
+ f, err = os.CreateTemp("", "podman_save")
if err == nil {
defer func() { _ = os.Remove(f.Name()) }()
}