Skip to content

Commit

Permalink
make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Sep 17, 2022
1 parent b4418fd commit 598a255
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions plugin/guessmusic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"encoding/json"
"io/fs"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
Expand All @@ -30,7 +29,6 @@ import (
"github.com/wdvxdr1123/ZeroBot/extension/single"

// 图片输出

"github.com/FloatTech/zbputils/img/text"
)

Expand Down Expand Up @@ -341,7 +339,7 @@ func init() { // 插件主体
if cfg.Local {
err = os.MkdirAll(cfg.MusicPath, 0755)
if err == nil {
files, err := ioutil.ReadDir(cfg.MusicPath)
files, err := os.ReadDir(cfg.MusicPath)
if err == nil {
if len(files) == 0 {
ctx.SendChain(message.Text("缓存目录没有读取到任何歌单"))
Expand Down Expand Up @@ -634,7 +632,7 @@ func getcatlist(pathOfMusic string) error {
err = errors.Errorf("[生成文件夹错误]ERROR: %s", err)
return err
}
files, err := ioutil.ReadDir(pathOfMusic)
files, err := os.ReadDir(pathOfMusic)
if err != nil {
err = errors.Errorf("[读取本地列表错误]ERROR: %s", err)
return err
Expand All @@ -653,7 +651,7 @@ func musicLottery(mode, musicPath string) (musicName, pathOfMusic string, err er
err = errors.Errorf("[生成文件夹错误]ERROR: %s", err)
return
}
files, err := ioutil.ReadDir(pathOfMusic)
files, err := os.ReadDir(pathOfMusic)
if err != nil {
err = errors.Errorf("[读取本地列表错误]ERROR: %s", err)
return
Expand Down Expand Up @@ -707,7 +705,7 @@ func musicLottery(mode, musicPath string) (musicName, pathOfMusic string, err er
return
}

func getLocalMusic(files []fs.FileInfo) (musicName string) {
func getLocalMusic(files []fs.DirEntry) (musicName string) {
if len(files) > 1 {
musicName = files[rand.Intn(len(files))].Name()
} else {
Expand Down

0 comments on commit 598a255

Please sign in to comment.