imports: make ScanDir ignore go files start with dot

Adding "." Prefix Check for go files.

Fixes #42047
Change-Id: Ifc42bf562f52fdd304f9828b06fc57888fcd8049
Reviewed-on: https://go-review.googlesource.com/c/go/+/264078
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Keyuan 2020-10-20 19:47:29 -07:00 committed by Bryan C. Mills
parent 9c28a50fd1
commit ed2010e676
4 changed files with 18 additions and 1 deletions

View File

@ -34,7 +34,7 @@ func ScanDir(dir string, tags map[string]bool) ([]string, []string, error) {
}
}
if info.Mode().IsRegular() && !strings.HasPrefix(name, "_") && strings.HasSuffix(name, ".go") && MatchFile(name, tags) {
if info.Mode().IsRegular() && !strings.HasPrefix(name, "_") && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") && MatchFile(name, tags) {
files = append(files, filepath.Join(dir, name))
}
}

View File

@ -0,0 +1,3 @@
package android
import _ "h"

View File

@ -0,0 +1,3 @@
package android
import _ "h"

View File

@ -0,0 +1,11 @@
cp go.mod go.mod.orig
go mod tidy
cmp go.mod go.mod.orig
-- go.mod --
module m.test
go 1.16
-- .ignore.go --
package p
import _ "golang.org/x/mod/modfile"