mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
imports: skip $GOPATH/src/v and $GOPATH/src/mod
These are both vgo module cache locations (originally v, soon to be mod). Vgo dumps a lot of code into these directories. If goimports walks in there, it takes forever. Change-Id: I667b0a4979bf6a6b71c3651d25ec29777ff15301 Reviewed-on: https://go-review.googlesource.com/119337 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
465e6f3992
commit
c06a8d8ed1
@ -640,6 +640,8 @@ func scanGoDirs(which goDirType) {
|
||||
continue
|
||||
}
|
||||
testHookScanDir(srcDir)
|
||||
srcV := filepath.Join(srcDir, "v")
|
||||
srcMod := filepath.Join(srcDir, "mod")
|
||||
walkFn := func(path string, typ os.FileMode) error {
|
||||
dir := filepath.Dir(path)
|
||||
if typ.IsRegular() {
|
||||
@ -648,6 +650,9 @@ func scanGoDirs(which goDirType) {
|
||||
// directly in your $GOPATH/src or $GOROOT/src.
|
||||
return nil
|
||||
}
|
||||
if dir == srcV || dir == srcMod {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
if !strings.HasSuffix(path, ".go") {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user