change: replace ioutil.ReadAll with io.ReadAll

This commit is contained in:
lilong.129
2023-08-29 17:27:54 +08:00
parent 97430bf451
commit b64fe9cfdd
6 changed files with 10 additions and 12 deletions
+1 -2
View File
@@ -3,7 +3,6 @@ package gadb
import (
"fmt"
"io"
"io/ioutil"
"net"
"regexp"
"strconv"
@@ -97,7 +96,7 @@ func (t transport) ReadStringAll() (s string, err error) {
}
func (t transport) ReadBytesAll() (raw []byte, err error) {
raw, err = ioutil.ReadAll(t.sock)
raw, err = io.ReadAll(t.sock)
return
}
@@ -5,7 +5,6 @@ import (
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"strings"
"time"
@@ -109,7 +108,7 @@ func (c *PcapdClient) GetPacket(buf []byte) ([]byte, error) {
}
}
packet, err := ioutil.ReadAll(preader)
packet, err := io.ReadAll(preader)
if err != nil {
return packet, err
}
+1 -1
View File
@@ -72,7 +72,7 @@ func (wd *Driver) httpRequest(method string, rawURL string, rawBody []byte) (raw
_ = resp.Body.Close()
}()
rawResp, err = ioutil.ReadAll(resp.Body)
rawResp, err = io.ReadAll(resp.Body)
logger := log.Debug().Int("statusCode", resp.StatusCode).Str("duration", time.Since(start).String())
if !strings.HasSuffix(rawURL, "screenshot") {
// avoid printing screenshot data
+3 -3
View File
@@ -7,7 +7,7 @@ import (
"fmt"
"image"
"image/color"
"io/ioutil"
"io"
"math"
"os"
@@ -133,7 +133,7 @@ func getBufFromDisk(name string) (*bytes.Buffer, error) {
return nil, err
}
var all []byte
if all, err = ioutil.ReadAll(f); err != nil {
if all, err = io.ReadAll(f); err != nil {
return nil, err
}
return bytes.NewBuffer(all), nil
@@ -361,7 +361,7 @@ func getMatsFromDisk(nameImage, nameTpl string, flags gocv.IMReadFlag) (matImage
// return nil, e
// }
// var all []byte
// if all, e = ioutil.ReadAll(f); e != nil {
// if all, e = io.ReadAll(f); e != nil {
// return nil, e
// }
// return bytes.NewBuffer(all), nil