chore: replace ioutil -> io

This commit is contained in:
henry.chen
2024-11-04 10:31:28 +08:00
parent 27bc610a31
commit 6e1965a764
8 changed files with 27 additions and 26 deletions

View File

@@ -4,7 +4,7 @@ package tools
import (
"encoding/base64"
htmpl "html/template"
"io/ioutil"
"io"
"log"
"net/http"
"strings"
@@ -62,7 +62,7 @@ func GetAvatar(domain string) string {
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
log.Println(err)
return ""

View File

@@ -6,7 +6,7 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"os"
"path"
"regexp"
"time"
@@ -23,8 +23,8 @@ func EncryptPasswd(name, pass string) string {
}
// ReadDirFiles 读取目录
func ReadDirFiles(dir string, filter func(fi fs.FileInfo) bool) (files []string) {
fileInfos, err := ioutil.ReadDir(dir)
func ReadDirFiles(dir string, filter func(fi fs.DirEntry) bool) (files []string) {
fileInfos, err := os.ReadDir(dir)
if err != nil {
return
}