mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
fix issue #1190
This commit is contained in:
@ -51,6 +51,10 @@ func MainPkgPath() string {
|
||||
if goRootForFilter != "" && len(file) >= len(goRootForFilter) && file[0:len(goRootForFilter)] == goRootForFilter {
|
||||
continue
|
||||
}
|
||||
if Ext(file) != ".go" {
|
||||
continue
|
||||
}
|
||||
lastFile = file
|
||||
// Check if it is called in package initialization function,
|
||||
// in which it here cannot retrieve main package path,
|
||||
// it so just returns that can make next check.
|
||||
@ -60,10 +64,6 @@ func MainPkgPath() string {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if Ext(file) != ".go" {
|
||||
continue
|
||||
}
|
||||
lastFile = file
|
||||
if gregex.IsMatchString(`package\s+main`, GetContents(file)) {
|
||||
mainPkgPath.Set(Dir(file))
|
||||
return Dir(file)
|
||||
|
||||
Reference in New Issue
Block a user