Bug fix on isValidFile

This commit is contained in:
Samuel Hawksby-Robinson 2021-03-05 23:24:36 +00:00
parent 2b438d3578
commit 2df33fe301
No known key found for this signature in database
GPG Key ID: 64CF99D4A64A1205
1 changed files with 5 additions and 4 deletions

View File

@ -135,16 +135,17 @@ func (tf *TodoFinder) FindInDir(dir string) error {
} }
func (tf TodoFinder) isValidFile(name string) bool { func (tf TodoFinder) isValidFile(name string) bool {
valid := false
for _, ft := range tf.repo.FileTypes { for _, ft := range tf.repo.FileTypes {
ftl := len(ft) + 1 ftl := len(ft) + 1
if len(name) < ftl { if len(name) < ftl {
return false return false
} }
last := name[ftl:] last := name[len(name)-ftl:]
valid = last == "."+ft if last == "."+ft {
return true
}
} }
return valid return false
} }
func (tf TodoFinder) buildRegexPattern() string { func (tf TodoFinder) buildRegexPattern() string {