diff options
author | Chris Evich <cevich@redhat.com> | 2022-09-20 09:59:28 -0400 |
---|---|---|
committer | Chris Evich <cevich@redhat.com> | 2022-09-20 15:34:27 -0400 |
commit | d968f3fe09a4c7d74464cfe2eaa9e4febbe61ba5 (patch) | |
tree | edc3b78d1565b5df8074c0cf47c1d1cf1126a97a /pkg/api/handlers/compat/images_push.go | |
parent | 30231d0da7e6dcf3d6d1f45b10150baae35aaf28 (diff) | |
download | podman-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/api/handlers/compat/images_push.go')
-rw-r--r-- | pkg/api/handlers/compat/images_push.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go index a1173de0b..e1655a3bc 100644 --- a/pkg/api/handlers/compat/images_push.go +++ b/pkg/api/handlers/compat/images_push.go @@ -4,8 +4,9 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" + "os" "strings" "github.com/containers/image/v5/types" @@ -26,7 +27,7 @@ func PushImage(w http.ResponseWriter, r *http.Request) { decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder) runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime) - digestFile, err := ioutil.TempFile("", "digest.txt") + digestFile, err := os.CreateTemp("", "digest.txt") if err != nil { utils.Error(w, http.StatusInternalServerError, fmt.Errorf("unable to create tempfile: %w", err)) return @@ -186,7 +187,7 @@ loop: // break out of for/select infinite loop break loop } - digestBytes, err := ioutil.ReadAll(digestFile) + digestBytes, err := io.ReadAll(digestFile) if err != nil { report.Error = &jsonmessage.JSONError{ Message: err.Error(), |