mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-08 16:20:02 +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"
|
_ "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")
|
||||||
}
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue