mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 20:40:25 +08:00
优化代码
This commit is contained in:
@@ -2,11 +2,11 @@ package configutils
|
||||
|
||||
import (
|
||||
"gopkg.in/yaml.v3"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
func UnmarshalYamlFile(file string, ptr interface{}) error {
|
||||
data, err := ioutil.ReadFile(file)
|
||||
data, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strconv"
|
||||
)
|
||||
@@ -113,7 +113,7 @@ func SharedNodeConfig() (*NodeConfig, error) {
|
||||
return sharedNodeConfig, nil
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(Tea.ConfigFile("node.json"))
|
||||
data, err := os.ReadFile(Tea.ConfigFile("node.json"))
|
||||
if err != nil {
|
||||
return &NodeConfig{}, err
|
||||
}
|
||||
@@ -403,7 +403,7 @@ func (this *NodeConfig) Save() error {
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(Tea.ConfigFile("node.json"), data, 0777)
|
||||
return os.WriteFile(Tea.ConfigFile("node.json"), data, 0777)
|
||||
}
|
||||
|
||||
// PaddedId 获取填充后的ID
|
||||
|
||||
Reference in New Issue
Block a user