improve gfile.MainPkgPath

This commit is contained in:
John
2019-05-17 21:37:48 +08:00
parent dd2436925b
commit 1af482d950
2 changed files with 6 additions and 8 deletions

View File

@ -454,6 +454,9 @@ func MainPkgPath() string {
if gstr.Contains(file, "/gf/g/") {
continue
}
if Ext(file) != ".go" {
continue
}
path = file
for path != "/" && gstr.Contains(path, "/") {
files, _ := ScanDir(path, "*.go")

View File

@ -653,8 +653,8 @@ func TestMkdir(t *testing.T) {
func TestStat(t *testing.T) {
gtest.Case(t, func() {
var (
tpath1 string = "/testfile_t1.txt"
tpath2 string = "./testfile_t1_no.txt"
tpath1 = "/testfile_t1.txt"
tpath2 = "./testfile_t1_no.txt"
err error
fileiofo os.FileInfo
)
@ -675,12 +675,7 @@ func TestStat(t *testing.T) {
func TestMainPkgPath(t *testing.T) {
gtest.Case(t, func() {
var (
reads string
)
reads = gfile.MainPkgPath()
reads := gfile.MainPkgPath()
gtest.Assert(reads, "")
})
}