From 2df33fe3010e68d878315d08414985cd605fcd0e Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Fri, 5 Mar 2021 23:24:36 +0000 Subject: [PATCH] Bug fix on isValidFile --- todo_finder.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/todo_finder.go b/todo_finder.go index 38f3960..b43fab1 100644 --- a/todo_finder.go +++ b/todo_finder.go @@ -135,16 +135,17 @@ func (tf *TodoFinder) FindInDir(dir string) error { } func (tf TodoFinder) isValidFile(name string) bool { - valid := false for _, ft := range tf.repo.FileTypes { ftl := len(ft) + 1 if len(name) < ftl { return false } - last := name[ftl:] - valid = last == "."+ft + last := name[len(name)-ftl:] + if last == "."+ft { + return true + } } - return valid + return false } func (tf TodoFinder) buildRegexPattern() string {