调整ioutil为go1.16推荐语法 (#1209)

* perf:根据go1.16后的提议修改包使用

* perf:根据go1.16后的提议修改包使用以及修改中间件的代码冗余
This commit is contained in:
XiaoK29
2022-08-29 15:40:40 +08:00
committed by GitHub
parent ed9ca764d4
commit 091b61bd10
9 changed files with 32 additions and 34 deletions

View File

@@ -5,7 +5,6 @@ package packfile
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -24,7 +23,7 @@ func writeFile(path string, data []byte) {
// 已存在的文件,不应该覆盖重写,可能在前端更改了配置文件等
if _, err := os.Stat(path); os.IsNotExist(err) {
if err2 := ioutil.WriteFile(path, data, os.ModePerm); err2 != nil {
if err2 := os.WriteFile(path, data, os.ModePerm); err2 != nil {
fmt.Printf("Write file failed: %s\n", path)
}
} else {