mirror of https://gitee.com/answerdev/answer.git
style(io): replace deprecated io function
This commit is contained in:
parent
88160ed512
commit
7331353b51
|
@ -2,8 +2,8 @@ package middleware
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
@ -44,7 +44,7 @@ func (am *AvatarMiddleware) AvatarThumb() gin.HandlerFunc {
|
|||
filePath := fmt.Sprintf("%s/avatar/%s", uploadPath, urlfileName)
|
||||
var avatarfile []byte
|
||||
if size == 0 {
|
||||
avatarfile, err = ioutil.ReadFile(filePath)
|
||||
avatarfile, err = os.ReadFile(filePath)
|
||||
} else {
|
||||
avatarfile, err = am.uploaderService.AvatarThumbFile(ctx, uploadPath, urlfileName, size)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -208,7 +208,7 @@ func (ds *DashboardService) RemoteVersion(ctx context.Context) string {
|
|||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
respByte, err := ioutil.ReadAll(resp.Body)
|
||||
respByte, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Error("http.Client error", err)
|
||||
return ""
|
||||
|
|
Loading…
Reference in New Issue