Replace deprecated ioutil with io and os

https://pkg.go.dev/io/ioutil is deprecated since Go 1.16.
This commit is contained in:
Oleksandr Redko
2023-02-19 00:43:26 +02:00
committed by Bjørn Erik Pedersen
parent 97b010f521
commit d453c12742
36 changed files with 112 additions and 191 deletions

View File

@@ -16,7 +16,7 @@ package transform
import (
"bytes"
"io"
"io/ioutil"
"os"
bp "github.com/gohugoio/hugo/bufferpool"
"github.com/gohugoio/hugo/common/herrors"
@@ -108,7 +108,7 @@ func (c *Chain) Apply(to io.Writer, from io.Reader) error {
if err := tr(fb); err != nil {
// Write output to a temp file so it can be read by the user for trouble shooting.
filename := "output.html"
tempfile, ferr := ioutil.TempFile("", "hugo-transform-error")
tempfile, ferr := os.CreateTemp("", "hugo-transform-error")
if ferr == nil {
filename = tempfile.Name()
defer tempfile.Close()