patch IsDotFile function compatible with both '.' and '..'

Signed-off-by: Huitse Tai <geb.1989@gmail.com>
This commit is contained in:
Huitse Tai 2017-10-18 12:50:33 +08:00
parent 887bc6a4be
commit a786f6175e

View File

@ -40,8 +40,9 @@ func IsConfiguration(path string) bool {
// IsDotFile returns whether or not path has dot as a prefix.
func IsDotFile(path string) bool {
path = filepath.Clean(path)
base := filepath.Base(path)
return strings.HasPrefix(base, ".") && len(base) > len(".")
return strings.HasPrefix(base, ".") && base != "." && base != ".."
}
// IsVendor returns whether or not path is a vendor path.