mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 16:53:46 +02:00
fix: Remove references to deprecated io/ioutil pkg (#2867)
* Update benchmark_test * Updae tar.go * Update further refs * Commit next set of replacements * Reverting changes in vendor folder * Update integreation_with_context_test.go * Update k8s_test.go * Update remaining usages * Replace conflicting usage of fs local variable
This commit is contained in:
Vendored
+3
-4
@@ -20,7 +20,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
@@ -109,7 +108,7 @@ func writeBufsToFile(cachePath string, tarBuf, manifestBuf *bytes.Buffer) error
|
||||
}
|
||||
|
||||
mfstPath := cachePath + ".json"
|
||||
if err := ioutil.WriteFile(mfstPath, manifestBuf.Bytes(), 0666); err != nil {
|
||||
if err := os.WriteFile(mfstPath, manifestBuf.Bytes(), 0666); err != nil {
|
||||
return errors.Wrap(err, "Failed to save manifest to file")
|
||||
}
|
||||
|
||||
@@ -186,9 +185,9 @@ func ParseDockerfile(opts *config.WarmerOptions) ([]string, error) {
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
d, err = ioutil.ReadAll(response.Body)
|
||||
d, err = io.ReadAll(response.Body)
|
||||
} else {
|
||||
d, err = ioutil.ReadFile(opts.DockerfilePath)
|
||||
d, err = os.ReadFile(opts.DockerfilePath)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Vendored
+4
-5
@@ -18,7 +18,6 @@ package cache
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -119,7 +118,7 @@ func TestParseDockerfile_SingleStageDockerfile(t *testing.T) {
|
||||
dockerfile := `FROM alpine:latest
|
||||
LABEL maintainer="alexezio"
|
||||
`
|
||||
tmpfile, err := ioutil.TempFile("", "example")
|
||||
tmpfile, err := os.CreateTemp("", "example")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -152,7 +151,7 @@ LABEL maintainer="alexezio"
|
||||
FROM alpine:latest as RUNNER
|
||||
LABEL maintainer="alexezio"
|
||||
`
|
||||
tmpfile, err := ioutil.TempFile("", "example")
|
||||
tmpfile, err := os.CreateTemp("", "example")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -186,7 +185,7 @@ func TestParseDockerfile_ArgsDockerfile(t *testing.T) {
|
||||
dockerfile := `ARG version=latest
|
||||
FROM golang:${version}
|
||||
`
|
||||
tmpfile, err := ioutil.TempFile("", "example")
|
||||
tmpfile, err := os.CreateTemp("", "example")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -225,7 +224,7 @@ func TestParseDockerfile_MissingsDockerfile(t *testing.T) {
|
||||
|
||||
func TestParseDockerfile_InvalidsDockerfile(t *testing.T) {
|
||||
dockerfile := "This is a invalid dockerfile"
|
||||
tmpfile, err := ioutil.TempFile("", "example")
|
||||
tmpfile, err := os.CreateTemp("", "example")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user