Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove refs to deprecated io/ioutil #1404

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/webhook/util/health/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"os"
"path"
"sync"

Expand All @@ -40,7 +40,7 @@ var (
)

func loadHTTPClientWithCACert() error {
caCert, err := ioutil.ReadFile(caCertFilePath)
caCert, err := os.ReadFile(caCertFilePath)
if err != nil {
return err
}
Expand Down
9 changes: 4 additions & 5 deletions pkg/webhook/util/writer/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package writer
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path"

Expand Down Expand Up @@ -158,19 +157,19 @@ func (f *fsCertWriter) read() (*generator.Artifacts, error) {
if err := ensureExist(f.Path); err != nil {
return nil, err
}
caKeyBytes, err := ioutil.ReadFile(path.Join(f.Path, CAKeyName))
caKeyBytes, err := os.ReadFile(path.Join(f.Path, CAKeyName))
if err != nil {
return nil, err
}
caCertBytes, err := ioutil.ReadFile(path.Join(f.Path, CACertName))
caCertBytes, err := os.ReadFile(path.Join(f.Path, CACertName))
if err != nil {
return nil, err
}
certBytes, err := ioutil.ReadFile(path.Join(f.Path, ServerCertName))
certBytes, err := os.ReadFile(path.Join(f.Path, ServerCertName))
if err != nil {
return nil, err
}
keyBytes, err := ioutil.ReadFile(path.Join(f.Path, ServerKeyName))
keyBytes, err := os.ReadFile(path.Join(f.Path, ServerKeyName))
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package framework
import (
"flag"
"fmt"
"io/ioutil"
"os"
"time"

Expand Down Expand Up @@ -346,7 +345,7 @@ func AfterReadingAllFlags(t *TestContextType) {
if len(t.Host) == 0 && len(t.KubeConfig) == 0 {
// Check if we can use the in-cluster config
if clusterConfig, err := restclient.InClusterConfig(); err == nil {
if tempFile, err := ioutil.TempFile(os.TempDir(), "kubeconfig-"); err == nil {
if tempFile, err := os.CreateTemp(os.TempDir(), "kubeconfig-"); err == nil {
kubeConfig := createKubeConfig(clusterConfig)
clientcmd.WriteToFile(*kubeConfig, tempFile.Name())
t.KubeConfig = tempFile.Name()
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/framework/testfiles/testfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"errors"
"fmt"
"io/fs"
"io/ioutil"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -123,7 +122,7 @@ func (r RootFileSource) ReadTestFile(filePath string) ([]byte, error) {
} else {
fullPath = filepath.Join(r.Root, filePath)
}
data, err := ioutil.ReadFile(fullPath)
data, err := os.ReadFile(fullPath)
if os.IsNotExist(err) {
// Not an error (yet), some other provider may have the file.
return nil, nil
Expand Down
Loading