Skip to content

Commit

Permalink
Merge pull request #15476 from testwill/ioutil
Browse files Browse the repository at this point in the history
chore: remove refs to deprecated io/ioutil
  • Loading branch information
k8s-ci-robot authored Jun 7, 2023
2 parents 36334f4 + da8c0ca commit a9c1d14
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
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

0 comments on commit a9c1d14

Please sign in to comment.