调整ioutil为go1.16推荐语法 (#1209)
* perf:根据go1.16后的提议修改包使用 * perf:根据go1.16后的提议修改包使用以及修改中间件的代码冗余
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user