Skip to content

Commit c04f83e

Browse files
authored
chore: remove refs to deprecated io/ioutil (#116)
1 parent 1242252 commit c04f83e

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

json.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"encoding/json"
77
"fmt"
88
"io"
9-
"io/ioutil"
109
)
1110

1211
type jsonPDFGenerator struct {
@@ -45,7 +44,7 @@ func (pdfg *PDFGenerator) ToJSON() ([]byte, error) {
4544
jp.PageOptions = tp.PageOptions
4645
}
4746
if p.Reader() != nil {
48-
buf, err := ioutil.ReadAll(p.Reader())
47+
buf, err := io.ReadAll(p.Reader())
4948
if err != nil {
5049
return nil, err
5150
}

json_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package wkhtmltopdf
33
import (
44
"bytes"
55
"encoding/json"
6-
"io/ioutil"
6+
"io"
77
"os"
88
"reflect"
99
"testing"
@@ -62,7 +62,7 @@ func TestNewPDFGeneratorFromJSON(t *testing.T) {
6262
func TestNewPDFGeneratorFromJSONWithReader(t *testing.T) {
6363

6464
pdfg := NewPDFPreparer()
65-
htmlfile, err := ioutil.ReadFile("testdata/htmlsimple.html")
65+
htmlfile, err := os.ReadFile("testdata/htmlsimple.html")
6666
if err != nil {
6767
t.Fatal(err)
6868
}
@@ -84,7 +84,7 @@ func TestNewPDFGeneratorFromJSONWithReader(t *testing.T) {
8484
}
8585

8686
// assert content
87-
buf, err := ioutil.ReadAll(pdfgFromJSON.pages[0].Reader())
87+
buf, err := io.ReadAll(pdfgFromJSON.pages[0].Reader())
8888
if err != nil {
8989
t.Fatal(err)
9090
}

wkhtmltopdf_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"context"
66
"errors"
7-
"io/ioutil"
87
"os"
98
"os/exec"
109
"path/filepath"
@@ -214,7 +213,7 @@ func TestPDFGeneratorOutputFile(t *testing.T) {
214213
func TestGeneratePdfFromStdinHtml5(t *testing.T) {
215214
//Use newTestPDFGenerator and append to page1 and TOC
216215
pdfg := newTestPDFGenerator(t)
217-
htmlfile, err := ioutil.ReadFile("testdata/html5.html")
216+
htmlfile, err := os.ReadFile("testdata/html5.html")
218217
if err != nil {
219218
t.Fatal(err)
220219
}

0 commit comments

Comments
 (0)