From 2e807710bcd9b880ac4f31b7b3063039d83f9708 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Mon, 4 Aug 2025 21:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9D=E5=A7=8B=E6=97=A0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE=E5=86=99?= =?UTF-8?q?=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/conf.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/proto/conf.go b/proto/conf.go index 345b522..a7de18d 100644 --- a/proto/conf.go +++ b/proto/conf.go @@ -128,7 +128,13 @@ func ReadConfig(path string) error { } defer file.Close() encoder := json.NewEncoder(file) - err = encoder.Encode(&Config) + + 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") }