mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-08 08:10:08 +00:00
Lint: Replace deprecated io/ioutil package
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a396cab2a7
commit
7fa2c2e4b6
3 changed files with 4 additions and 6 deletions
|
@ -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")
|
||||
}
|
||||
|
|
4
main.go
4
main.go
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue