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 #15476

Merged
merged 1 commit into from
Jun 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 cloudmock/gce/gcphttp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
)

Expand Down Expand Up @@ -101,7 +101,7 @@ func buildJSONResponse(statusCode int, obj interface{}) (*http.Response, error)
r.Header = make(http.Header)
r.Header.Add("Content-Type", "application/json; charset=UTF-8")

r.Body = ioutil.NopCloser(bytes.NewReader(b))
r.Body = io.NopCloser(bytes.NewReader(b))

return r, nil
}
4 changes: 2 additions & 2 deletions pkg/applylib/mocks/mockkubeapiserver/patchresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package mockkubeapiserver

import (
"fmt"
"io/ioutil"
"io"
"net/http"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand All @@ -43,7 +43,7 @@ func (req *patchResource) Run(s *MockKubeAPIServer) error {
existing = objects.Objects[id]
}

bodyBytes, err := ioutil.ReadAll(req.r.Body)
bodyBytes, err := io.ReadAll(req.r.Body)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/applylib/mocks/mockkubeapiserver/putresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package mockkubeapiserver

import (
"fmt"
"io/ioutil"
"io"
"net/http"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -48,7 +48,7 @@ func (req *putResource) Run(s *MockKubeAPIServer) error {
return req.writeErrorResponse(http.StatusNotFound)
}

bodyBytes, err := ioutil.ReadAll(req.r.Body)
bodyBytes, err := io.ReadAll(req.r.Body)
if err != nil {
return err
}
Expand Down
5 changes: 2 additions & 3 deletions upup/pkg/fi/cloudup/openstack/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -86,7 +85,7 @@ func newMetadataService(serviceURL string, configDrivePath string, mounter *moun

// GetLocalMetadata returns a local metadata for the server
func GetLocalMetadata() (*InstanceMetadata, error) {
mountTarget, err := ioutil.TempDir("", "configdrive")
mountTarget, err := os.MkdirTemp("", "configdrive")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -153,7 +152,7 @@ func (mds MetadataService) getFromMetadataService() (*InstanceMetadata, error) {
func (mds MetadataService) parseMetadata(r io.Reader) (*InstanceMetadata, error) {
var meta InstanceMetadata

data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions util/pkg/vfs/gsfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -420,7 +419,7 @@ type terraformGSObjectAccessControl struct {
}

func (p *GSPath) RenderTerraform(w *terraformWriter.TerraformWriter, name string, data io.Reader, acl ACL) error {
bytes, err := ioutil.ReadAll(data)
bytes, err := io.ReadAll(data)
if err != nil {
return fmt.Errorf("reading data: %v", err)
}
Expand Down