Lint: Replace deprecated io/ioutil package

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-09-06 00:34:30 +02:00
parent a396cab2a7
commit 7fa2c2e4b6
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
3 changed files with 4 additions and 6 deletions

View file

@ -4,7 +4,6 @@ import (
_ "embed"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"sync"
@ -199,7 +198,7 @@ func patchConfig(filename, authorName, authorEmail, summary string, patcher func
}
func writeConfigToYAML(filename, authorName, authorEmail, summary string, obj *configFile) error {
tmpFile, err := ioutil.TempFile(path.Dir(filename), "twitch-bot-*.yaml")
tmpFile, err := os.CreateTemp(path.Dir(filename), "twitch-bot-*.yaml")
if err != nil {
return errors.Wrap(err, "opening tempfile")
}

View file

@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"io"
"math"
"net"
"net/http"
@ -399,7 +399,7 @@ func checkExternalHTTP() {
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
log.WithError(err).Error("Unable to read selfcheck response")
return

View file

@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
@ -805,7 +804,7 @@ func (c *Client) request(opts clientRequestOpts) error {
}
if opts.OKStatus != 0 && resp.StatusCode != opts.OKStatus {
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return newHTTPError(resp.StatusCode, nil, err)
}