style(io): replace deprecated io function

This commit is contained in:
LinkinStar 2022-12-16 14:31:38 +08:00
parent 88160ed512
commit 7331353b51
2 changed files with 4 additions and 4 deletions

View File

@ -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)
}

View File

@ -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 ""