This commit is contained in:
Back Yu 2017-03-07 06:31:03 +00:00 committed by GitHub
commit d7b329de99
1 changed files with 10 additions and 2 deletions

View File

@ -962,13 +962,21 @@ func getPackagePath(curpath string) (packpath string) {
wgopath := filepath.SplitList(gopath)
for _, wg := range wgopath {
wg, _ = filepath.EvalSymlinks(path.Join(wg, "src"))
//Maybe is a path
if filepath.HasPrefix(strings.ToLower(curpath), strings.ToLower(wg)) {
haspath = true
appsrcpath = wg
break
}
//Maybe is a symlink
wg, _ = filepath.EvalSymlinks(path.Join(wg, "src"))
cur,_ := filepath.EvalSymlinks(curpath)
if filepath.HasPrefix(strings.ToLower(cur), strings.ToLower(wg)) {
haspath = true
appsrcpath = wg
break
}
}
if !haspath {