From 6590fcbb1144c1d34d681c300ef4d24bd571aa14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Sat, 2 Dec 2023 22:56:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E7=BB=9D=E5=AF=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=A2=AB=E7=BC=96=E8=AF=91=E8=BF=9B=E4=BA=8C=E8=BF=9B?= =?UTF-8?q?=E5=88=B6=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/config.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/models/config.go b/models/config.go index 14228b4..a7d5335 100644 --- a/models/config.go +++ b/models/config.go @@ -9,12 +9,13 @@ import ( ) var ( - _, b, _, _ = runtime.Caller(0) - Root = filepath.Join(filepath.Dir(b), "..") - Viper *viper.Viper + Root string + Viper *viper.Viper ) func init() { + _, b, _, _ := runtime.Caller(0) + Root = filepath.Join(filepath.Dir(b), "..") config_file := filepath.Join(Root, "data", "config.yaml") viper.SetConfigFile(config_file) if err := viper.ReadInConfig(); err != nil {