From fb1401ffaadd59a311453428c2a9985c7d5776a0 Mon Sep 17 00:00:00 2001 From: 14March <53811984+hcraM41@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:32:36 +0800 Subject: [PATCH] replace "io/ioutil" --- file/config_export.go | 8 ++++---- file/config_import.go | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/file/config_export.go b/file/config_export.go index 491b458..a7fbc43 100644 --- a/file/config_export.go +++ b/file/config_export.go @@ -3,9 +3,9 @@ package file import ( "errors" "fmt" - "io/ioutil" "kis-flow/common" "kis-flow/kis" + "os" "gopkg.in/yaml.v3" ) @@ -17,7 +17,7 @@ func ConfigExportYaml(flow kis.Flow, savaPath string) error { return err } else { // flow - err := ioutil.WriteFile(savaPath+common.KisIdTypeFlow+"-"+flow.GetName()+".yaml", data, 0644) + err := os.WriteFile(savaPath+common.KisIdTypeFlow+"-"+flow.GetName()+".yaml", data, 0644) if err != nil { return err } @@ -32,7 +32,7 @@ func ConfigExportYaml(flow kis.Flow, savaPath string) error { if fdata, err := yaml.Marshal(fConf); err != nil { return err } else { - if err := ioutil.WriteFile(savaPath+common.KisIdTypeFunction+"-"+fp.FuncName+".yaml", fdata, 0644); err != nil { + if err := os.WriteFile(savaPath+common.KisIdTypeFunction+"-"+fp.FuncName+".yaml", fdata, 0644); err != nil { return err } } @@ -46,7 +46,7 @@ func ConfigExportYaml(flow kis.Flow, savaPath string) error { if cdata, err := yaml.Marshal(cConf); err != nil { return err } else { - if err := ioutil.WriteFile(savaPath+common.KisIdTypeConnector+"-"+cConf.CName+".yaml", cdata, 0644); err != nil { + if err := os.WriteFile(savaPath+common.KisIdTypeConnector+"-"+cConf.CName+".yaml", cdata, 0644); err != nil { return err } } diff --git a/file/config_import.go b/file/config_import.go index 92b9fad..66160b3 100644 --- a/file/config_import.go +++ b/file/config_import.go @@ -3,7 +3,6 @@ package file import ( "errors" "fmt" - "io/ioutil" "kis-flow/common" "kis-flow/config" "kis-flow/flow" @@ -92,7 +91,7 @@ func parseConfigWalkYaml(loadPath string) (*allConfig, error) { } // 读取文件内容 - confData, err := ioutil.ReadFile(filePath) + confData, err := os.ReadFile(filePath) if err != nil { return err }