From a786f6175e494ed884ceaef92be44480d07685ff Mon Sep 17 00:00:00 2001 From: Huitse Tai Date: Wed, 18 Oct 2017 12:50:33 +0800 Subject: [PATCH] patch IsDotFile function compatible with both '.' and '..' Signed-off-by: Huitse Tai --- utils.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils.go b/utils.go index 4eb4a69..57d378d 100644 --- a/utils.go +++ b/utils.go @@ -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.