Skip to content

Commit

Permalink
Merge pull request #944 from austinvazquez/remove-ioutil-dep
Browse files Browse the repository at this point in the history
Remove io/ioutil references
  • Loading branch information
sudo-bmitch authored Sep 8, 2022
2 parents 50b6194 + da33ef0 commit d2cc46d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions schema/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"strings"

Expand Down Expand Up @@ -68,7 +67,7 @@ func (factory *fsLoaderFactory) refContents(ref gojsonreference.JsonReference) (
}
defer f.Close()

return ioutil.ReadAll(f)
return io.ReadAll(f)
}

// fsLoader implements gojsonschema.JSONLoader by reading the document named by source from a fsLoaderFactory.
Expand Down
3 changes: 1 addition & 2 deletions schema/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/url"
"os"
"path/filepath"
Expand Down Expand Up @@ -183,7 +182,7 @@ func parseExample(lang, body string) (e example) {
}

func extractExamples(rd io.Reader) ([]example, error) {
p, err := ioutil.ReadAll(rd)
p, err := io.ReadAll(rd)
if err != nil {
return nil, err
}
Expand Down
11 changes: 5 additions & 6 deletions schema/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"regexp"

digest "github.com/opencontainers/go-digest"
Expand Down Expand Up @@ -52,7 +51,7 @@ func (e ValidationError) Error() string {

// Validate validates the given reader against the schema of the wrapped media type.
func (v Validator) Validate(src io.Reader) error {
buf, err := ioutil.ReadAll(src)
buf, err := io.ReadAll(src)
if err != nil {
return errors.Wrap(err, "unable to read the document file")
}
Expand Down Expand Up @@ -100,7 +99,7 @@ func (v unimplemented) Validate(src io.Reader) error {
func validateManifest(r io.Reader) error {
header := v1.Manifest{}

buf, err := ioutil.ReadAll(r)
buf, err := io.ReadAll(r)
if err != nil {
return errors.Wrapf(err, "error reading the io stream")
}
Expand Down Expand Up @@ -130,7 +129,7 @@ func validateManifest(r io.Reader) error {
func validateDescriptor(r io.Reader) error {
header := v1.Descriptor{}

buf, err := ioutil.ReadAll(r)
buf, err := io.ReadAll(r)
if err != nil {
return errors.Wrapf(err, "error reading the io stream")
}
Expand All @@ -152,7 +151,7 @@ func validateDescriptor(r io.Reader) error {
func validateIndex(r io.Reader) error {
header := v1.Index{}

buf, err := ioutil.ReadAll(r)
buf, err := io.ReadAll(r)
if err != nil {
return errors.Wrapf(err, "error reading the io stream")
}
Expand All @@ -179,7 +178,7 @@ func validateIndex(r io.Reader) error {
func validateConfig(r io.Reader) error {
header := v1.Image{}

buf, err := ioutil.ReadAll(r)
buf, err := io.ReadAll(r)
if err != nil {
return errors.Wrapf(err, "error reading the io stream")
}
Expand Down

0 comments on commit d2cc46d

Please sign in to comment.