From ee8f72c7202b2ffd6a14fd881480f012aaaef58e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 9 Jul 2018 11:50:51 -0400 Subject: [PATCH] imports: avoid src/v and src/mod again This time for real. Change-Id: I480fd6e4aa591efaf8380e86f5447b8c2bc28cda Reviewed-on: https://go-review.googlesource.com/122615 Run-TryBot: Russ Cox TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- imports/fix.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imports/fix.go b/imports/fix.go index 72bc4516e6..b7662db847 100644 --- a/imports/fix.go +++ b/imports/fix.go @@ -643,6 +643,9 @@ func scanGoDirs(which goDirType) { srcV := filepath.Join(srcDir, "v") srcMod := filepath.Join(srcDir, "mod") walkFn := func(path string, typ os.FileMode) error { + if path == srcV || path == srcMod { + return filepath.SkipDir + } dir := filepath.Dir(path) if typ.IsRegular() { if dir == srcDir { @@ -650,9 +653,6 @@ 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 }