From f904596cbcfe111c838b81da9f2847a1c4fc4bc8 Mon Sep 17 00:00:00 2001 From: guangwu Date: Thu, 16 Nov 2023 19:16:15 +0800 Subject: [PATCH] chore: remove refs to deprecated io/ioutil (#5519) Signed-off-by: guoguangwu --- drivers/google_drive/util.go | 5 ++--- internal/net/request_test.go | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/google_drive/util.go b/drivers/google_drive/util.go index 2c1f13eb..0d380112 100644 --- a/drivers/google_drive/util.go +++ b/drivers/google_drive/util.go @@ -5,7 +5,6 @@ import ( "crypto/x509" "encoding/pem" "fmt" - "io/ioutil" "net/http" "os" "regexp" @@ -44,7 +43,7 @@ func (d *GoogleDrive) refreshToken() error { gdsaFileThis := d.RefreshToken if gdsaFile.IsDir() { if len(d.ServiceAccountFileList) <= 0 { - gdsaReadDir, gdsaDirErr := ioutil.ReadDir(d.RefreshToken) + gdsaReadDir, gdsaDirErr := os.ReadDir(d.RefreshToken) if gdsaDirErr != nil { log.Error("read dir fail") return gdsaDirErr @@ -76,7 +75,7 @@ func (d *GoogleDrive) refreshToken() error { } } - gdsaFileThisContent, err := ioutil.ReadFile(gdsaFileThis) + gdsaFileThisContent, err := os.ReadFile(gdsaFileThis) if err != nil { return err } diff --git a/internal/net/request_test.go b/internal/net/request_test.go index e41971fb..032b7376 100644 --- a/internal/net/request_test.go +++ b/internal/net/request_test.go @@ -8,7 +8,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net/http" "sync" "testing" @@ -169,7 +168,7 @@ func newDownloadRangeClient(data []byte) (*downloadCaptureClient, *int, *[]strin header := &http.Header{} header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", start, fin-1, len(data))) return &http.Response{ - Body: ioutil.NopCloser(bytes.NewReader(bodyBytes)), + Body: io.NopCloser(bytes.NewReader(bodyBytes)), Header: *header, ContentLength: int64(len(bodyBytes)), }, nil