diff options
author | Russ Cox <rsc@golang.org> | 2018-06-15 22:29:15 -0400 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-06-17 21:38:49 +0000 |
commit | c06a8d8ed11aae27b08c1c109a509ada9de81240 (patch) | |
tree | a71c6cfa09609bcd7163cdb413c379265d7dfbc2 /imports | |
parent | 465e6f399236d0ea2466584539d4eab4d3d83720 (diff) | |
download | golang-x-tools-c06a8d8ed11aae27b08c1c109a509ada9de81240.tar.gz |
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>
Diffstat (limited to 'imports')
-rw-r--r-- | imports/fix.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/imports/fix.go b/imports/fix.go index ebb228d1a..72bc4516e 100644 --- a/imports/fix.go +++ b/imports/fix.go @@ -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 } |