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" _ "embed"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"os" "os"
"path" "path"
"sync" "sync"
@ -199,7 +198,7 @@ func patchConfig(filename, authorName, authorEmail, summary string, patcher func
} }
func writeConfigToYAML(filename, authorName, authorEmail, summary string, obj *configFile) error { 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 { if err != nil {
return errors.Wrap(err, "opening tempfile") return errors.Wrap(err, "opening tempfile")
} }

View file

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

View file

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