From 0e69f7953a22d4aff968ab6dd14b754b42ed470a Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 25 Oct 2021 16:39:06 +0800 Subject: [PATCH] ws modify --- src/common/config/config.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/common/config/config.go b/src/common/config/config.go index 6294a031c..b873ef287 100644 --- a/src/common/config/config.go +++ b/src/common/config/config.go @@ -1,17 +1,9 @@ package config import ( - "io/ioutil" - "path/filepath" - "runtime" - "gopkg.in/yaml.v3" -) - -var ( - _, b, _, _ = runtime.Caller(0) - // Root folder of this project - Root = filepath.Join(filepath.Dir(b), "../../..") + "io/ioutil" + "os" ) var Config config @@ -156,9 +148,8 @@ type config struct { } func init() { - // if we cd Open-IM-Server/src/utils and run go test - // it will panic cannot find config/config.yaml - bytes, err := ioutil.ReadFile(Root + "/config/config.yaml") + path, _ := os.Getwd() + bytes, err := ioutil.ReadFile(path + "/config/config.yaml") if err != nil { panic(err) }