refactor: move from io/ioutil to io and os package (#1772)

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2021-09-27 08:55:23 +08:00
committed by GitHub
parent a2cce0ba77
commit 62af723017
25 changed files with 45 additions and 57 deletions

View File

@@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"os"
@@ -92,7 +91,7 @@ func loadURL(url string, scraperConfig config, globalConfig GlobalConfig) (io.Re
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
@@ -140,7 +139,7 @@ func urlFromCDP(url string, driverOptions scraperDriverOptions, globalConfig Glo
act, cancelAct = chromedp.NewRemoteAllocator(context.Background(), remote)
} else {
// use a temporary user directory for chrome
dir, err := ioutil.TempDir("", "stash-chromedp")
dir, err := os.MkdirTemp("", "stash-chromedp")
if err != nil {
return nil, err
}