diff --git a/json.go b/json.go index 7a7c6cc..24d6aad 100644 --- a/json.go +++ b/json.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" ) type jsonPDFGenerator struct { @@ -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 } diff --git a/json_test.go b/json_test.go index da478e3..22214cf 100644 --- a/json_test.go +++ b/json_test.go @@ -3,7 +3,7 @@ package wkhtmltopdf import ( "bytes" "encoding/json" - "io/ioutil" + "io" "os" "reflect" "testing" @@ -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) } @@ -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) } diff --git a/wkhtmltopdf_test.go b/wkhtmltopdf_test.go index 87ee7f3..e813351 100644 --- a/wkhtmltopdf_test.go +++ b/wkhtmltopdf_test.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "errors" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -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) }