File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ type block struct {
34
34
var vscDirs = []string {".git" , ".hg" , ".bzr" , ".svn" }
35
35
36
36
type cacheEntry struct {
37
- file string
38
- err error
37
+ dir string
38
+ err error
39
39
}
40
40
41
41
var pkgCache = map [string ]cacheEntry {}
@@ -46,16 +46,16 @@ func findFile(filePath string) (string, error) {
46
46
dir , file := filepath .Split (filePath )
47
47
var result cacheEntry
48
48
var ok bool
49
- if result , ok = pkgCache [filePath ]; ! ok {
49
+ if result , ok = pkgCache [dir ]; ! ok {
50
50
pkg , err := build .Import (dir , "." , build .FindOnly )
51
51
if err == nil {
52
- result = cacheEntry {filepath .Join (pkg .Dir , file ), nil }
52
+ result = cacheEntry {filepath .Join (pkg .Dir ), nil }
53
53
} else {
54
54
result = cacheEntry {"" , err }
55
55
}
56
- pkgCache [filePath ] = result
56
+ pkgCache [dir ] = result
57
57
}
58
- return result .file , result .err
58
+ return filepath . Join ( result .dir , file ) , result .err
59
59
}
60
60
61
61
// findRepositoryRoot finds the VCS root dir of a given dir
You can’t perform that action at this time.
0 commit comments