From 74bc36a2dc43129d70ad25c86940add2d2f881d1 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 19 Dec 2018 14:51:09 +0800 Subject: [PATCH] remove gfile.MainPkgPath check in gcfg/gview default path --- g/frame/gins/gins.go | 10 ++-------- g/os/gfsnotify/gfsnotify_watcher_loop.go | 6 ++---- g/os/glog/glog.go | 8 -------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/g/frame/gins/gins.go b/g/frame/gins/gins.go index 9b65d0a8e..9ebb0de99 100644 --- a/g/frame/gins/gins.go +++ b/g/frame/gins/gins.go @@ -76,10 +76,7 @@ func View(name...string) *gview.View { if path == "" { path = genv.Get("GF_VIEWPATH") if path == "" { - // gfile.MainPkgPath() 用以判断是否开发环境 - if gfile.MainPkgPath() == "" { - path = gfile.SelfDir() - } + path = gfile.SelfDir() } } view := gview.New(path) @@ -106,10 +103,7 @@ func Config(file...string) *gcfg.Config { if path == "" { path = genv.Get("GF_CFGPATH") if path == "" { - // gfile.MainPkgPath() 用以判断是否开发环境 - if gfile.MainPkgPath() == "" { - path = gfile.SelfDir() - } + path = gfile.SelfDir() } } config := gcfg.New(path, configFile) diff --git a/g/os/gfsnotify/gfsnotify_watcher_loop.go b/g/os/gfsnotify/gfsnotify_watcher_loop.go index 34401e307..772656e20 100644 --- a/g/os/gfsnotify/gfsnotify_watcher_loop.go +++ b/g/os/gfsnotify/gfsnotify_watcher_loop.go @@ -7,9 +7,7 @@ package gfsnotify import ( - "fmt" "gitee.com/johng/gf/g/container/glist" - "os" ) // 监听循环 @@ -33,8 +31,8 @@ func (w *Watcher) startWatchLoop() { return struct {}{} }, REPEAT_EVENT_FILTER_INTERVAL) - case err := <- w.watcher.Errors: - fmt.Fprintf(os.Stderr, "[gfsnotify] error: %s\n", err.Error()) + case <- w.watcher.Errors: + //fmt.Fprintf(os.Stderr, "[gfsnotify] error: %s\n", err.Error()) } } }() diff --git a/g/os/glog/glog.go b/g/os/glog/glog.go index 6820b2383..b213987db 100644 --- a/g/os/glog/glog.go +++ b/g/os/glog/glog.go @@ -11,7 +11,6 @@ package glog import ( "gitee.com/johng/gf/g/container/gtype" - "gitee.com/johng/gf/g/os/gfile" "io" ) @@ -33,13 +32,6 @@ var ( logger = New() ) -func init() { - // 自动识别开发环境 - if gfile.MainPkgPath() != "" { - logger.SetDebug(true) - } -} - // 日志日志目录绝对路径 func SetPath(path string) { logger.SetPath(path)