From 16d978dc5829c72c54b06a8b6de56745ff95bafa Mon Sep 17 00:00:00 2001 From: John Date: Tue, 4 Jun 2019 18:30:02 +0800 Subject: [PATCH] fix issue in gfile.MainPkgPath --- g/os/gfile/gfile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/g/os/gfile/gfile.go b/g/os/gfile/gfile.go index a5111de0c..e55e156f4 100644 --- a/g/os/gfile/gfile.go +++ b/g/os/gfile/gfile.go @@ -426,7 +426,7 @@ func MainPkgPath() string { } // separator of '/' will be converted to Separator. path = Dir(file) - for path != "/" && gstr.Contains(path, Separator) { + for path[len(path) - 1] != os.PathSeparator { files, _ := ScanDir(path, "*.go") for _, v := range files { if gregex.IsMatchString(`package\s+main`, GetContents(v)) {