Skip to content

Commit

Permalink
contextutil: fix inGopath on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
charlievieth committed May 19, 2022
1 parent 6c58370 commit 2db94cd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions contextutil/contextutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,24 @@ func inGopath(ctxt *build.Context, dir string) bool {
break
}
p := s[:n]
if p == dir || isSubdir(p, dir) || isSubdir(filepath.Clean(p), dir) {
if p == dir || isSubdir(p, dir) {
return true
}
if p != "" {
p = filepath.Clean(p)
if p == dir || isSubdir(p, dir) {
return true
}
}
s = s[n+1:]
}
return s == dir || isSubdir(s, dir) || isSubdir(filepath.Clean(s), dir)
if s != "" {
s = filepath.Clean(s)
if s == dir || isSubdir(s, dir) {
return true
}
}
return false
}

func sameFile(name, base string, baseInfo os.FileInfo) bool {
Expand Down

0 comments on commit 2db94cd

Please sign in to comment.