From b22f0fd537a54d0235c39cb5ae9216501d65dcda Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Sun, 12 May 2024 17:38:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/client/client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/client/client.go b/cmd/client/client.go index 28594a3..4aba3f0 100644 --- a/cmd/client/client.go +++ b/cmd/client/client.go @@ -38,7 +38,7 @@ var notification = toast.Notification{ var conf = new(config.Config) -func Main() { +func readConfig() error { viper.SetConfigName(constants.ConfigFileName) viper.SetConfigType(constants.ConfigType) for _, path := range constants.ConfigPaths { @@ -53,7 +53,11 @@ func Main() { } } - err := viper.Unmarshal(conf) + return viper.Unmarshal(conf) +} + +func Main() { + err := readConfig() if err != nil { logger.Log().Fatalf("配置文件解析失败: %s, 请检查配置是否有误", err) }