From 44b74e468b65178a9a832f9dfcbf254ef63898b0 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Sat, 6 Sep 2025 14:42:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E5=86=99?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/conf.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/proto/conf.go b/proto/conf.go index efc9b20..fb8634b 100644 --- a/proto/conf.go +++ b/proto/conf.go @@ -126,25 +126,7 @@ func ReadConfig(path string) error { fmt.Println("Config file not found!") //创建默认配置 DefaultConfig() - //写入json文件 - file, err := os.Create(path) - if err != nil { - fmt.Println("Error creating config file") - return err - } - defer file.Close() - encoder := json.NewEncoder(file) - - configData, err2 := json.MarshalIndent(Config, "", " ") - if err2 != nil { - log.Println("WriteConfigToFile json marshal error:", err) - return err2 - } - err = encoder.Encode(string(configData)) - if err != nil { - fmt.Println("Error encoding config") - } - return err + WriteConfigToFile() } //读json文件