From ebf5c21cde3aa3017feffad30e7d63f9c8467345 Mon Sep 17 00:00:00 2001 From: kzkzzzz Date: Sun, 23 Jun 2024 14:24:25 +0800 Subject: [PATCH] update --- myconf/conf.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/myconf/conf.go b/myconf/conf.go index 33ddc5c..881fe23 100644 --- a/myconf/conf.go +++ b/myconf/conf.go @@ -20,7 +20,15 @@ func LoadFlag() { } } -func LoadFile(confFile string, conf interface{}) { +func LoadFile(confFile string) { + vp.SetConfigFile(confFile) + err := vp.ReadInConfig() + if err != nil { + panic(fmt.Errorf("read file fail: %s", err)) + } +} + +func LoadFileTo(confFile string, conf interface{}) { vp.SetConfigFile(confFile) err := vp.ReadInConfig() if err != nil {