Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill committed Jul 24, 2023
1 parent 1242252 commit c04f83e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions json.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
)

type jsonPDFGenerator struct {
Expand Down Expand Up @@ -45,7 +44,7 @@ func (pdfg *PDFGenerator) ToJSON() ([]byte, error) {
jp.PageOptions = tp.PageOptions
}
if p.Reader() != nil {
buf, err := ioutil.ReadAll(p.Reader())
buf, err := io.ReadAll(p.Reader())
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package wkhtmltopdf
import (
"bytes"
"encoding/json"
"io/ioutil"
"io"
"os"
"reflect"
"testing"
Expand Down Expand Up @@ -62,7 +62,7 @@ func TestNewPDFGeneratorFromJSON(t *testing.T) {
func TestNewPDFGeneratorFromJSONWithReader(t *testing.T) {

pdfg := NewPDFPreparer()
htmlfile, err := ioutil.ReadFile("testdata/htmlsimple.html")
htmlfile, err := os.ReadFile("testdata/htmlsimple.html")
if err != nil {
t.Fatal(err)
}
Expand All @@ -84,7 +84,7 @@ func TestNewPDFGeneratorFromJSONWithReader(t *testing.T) {
}

// assert content
buf, err := ioutil.ReadAll(pdfgFromJSON.pages[0].Reader())
buf, err := io.ReadAll(pdfgFromJSON.pages[0].Reader())
if err != nil {
t.Fatal(err)
}
Expand Down
3 changes: 1 addition & 2 deletions wkhtmltopdf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"errors"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -214,7 +213,7 @@ func TestPDFGeneratorOutputFile(t *testing.T) {
func TestGeneratePdfFromStdinHtml5(t *testing.T) {
//Use newTestPDFGenerator and append to page1 and TOC
pdfg := newTestPDFGenerator(t)
htmlfile, err := ioutil.ReadFile("testdata/html5.html")
htmlfile, err := os.ReadFile("testdata/html5.html")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit c04f83e

Please sign in to comment.