Skip to content

Commit d2cc46d

Browse files
authored
Merge pull request #944 from austinvazquez/remove-ioutil-dep
Remove io/ioutil references
2 parents 50b6194 + da33ef0 commit d2cc46d

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

schema/loader.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"encoding/json"
2020
"fmt"
2121
"io"
22-
"io/ioutil"
2322
"net/http"
2423
"strings"
2524

@@ -68,7 +67,7 @@ func (factory *fsLoaderFactory) refContents(ref gojsonreference.JsonReference) (
6867
}
6968
defer f.Close()
7069

71-
return ioutil.ReadAll(f)
70+
return io.ReadAll(f)
7271
}
7372

7473
// fsLoader implements gojsonschema.JSONLoader by reading the document named by source from a fsLoaderFactory.

schema/spec_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"bytes"
1919
"fmt"
2020
"io"
21-
"io/ioutil"
2221
"net/url"
2322
"os"
2423
"path/filepath"
@@ -183,7 +182,7 @@ func parseExample(lang, body string) (e example) {
183182
}
184183

185184
func extractExamples(rd io.Reader) ([]example, error) {
186-
p, err := ioutil.ReadAll(rd)
185+
p, err := io.ReadAll(rd)
187186
if err != nil {
188187
return nil, err
189188
}

schema/validator.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"encoding/json"
2020
"fmt"
2121
"io"
22-
"io/ioutil"
2322
"regexp"
2423

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

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

103-
buf, err := ioutil.ReadAll(r)
102+
buf, err := io.ReadAll(r)
104103
if err != nil {
105104
return errors.Wrapf(err, "error reading the io stream")
106105
}
@@ -130,7 +129,7 @@ func validateManifest(r io.Reader) error {
130129
func validateDescriptor(r io.Reader) error {
131130
header := v1.Descriptor{}
132131

133-
buf, err := ioutil.ReadAll(r)
132+
buf, err := io.ReadAll(r)
134133
if err != nil {
135134
return errors.Wrapf(err, "error reading the io stream")
136135
}
@@ -152,7 +151,7 @@ func validateDescriptor(r io.Reader) error {
152151
func validateIndex(r io.Reader) error {
153152
header := v1.Index{}
154153

155-
buf, err := ioutil.ReadAll(r)
154+
buf, err := io.ReadAll(r)
156155
if err != nil {
157156
return errors.Wrapf(err, "error reading the io stream")
158157
}
@@ -179,7 +178,7 @@ func validateIndex(r io.Reader) error {
179178
func validateConfig(r io.Reader) error {
180179
header := v1.Image{}
181180

182-
buf, err := ioutil.ReadAll(r)
181+
buf, err := io.ReadAll(r)
183182
if err != nil {
184183
return errors.Wrapf(err, "error reading the io stream")
185184
}

0 commit comments

Comments
 (0)