From e68daa1077655088b5bdb1aeba3c44116d2663a7 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 28 Mar 2019 00:21:45 +0300 Subject: [PATCH] fix: excludeSuffixes wasn't skipping any files `continue` was just running one more iteration `for` loop, being effectively no-op. While I'm at it, added another return to make sure file license is validated only once even if matches multiple suffixes. Signed-off-by: Andrey Smirnov --- internal/policy/license/license.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/policy/license/license.go b/internal/policy/license/license.go index 0038dcd3..e0d9c1ed 100644 --- a/internal/policy/license/license.go +++ b/internal/policy/license/license.go @@ -45,7 +45,7 @@ func (l *License) Compliance(options *policy.Options) (report policy.Report) { // Skip excluded suffixes. for _, suffix := range l.ExcludeSuffixes { if strings.HasSuffix(info.Name(), suffix) { - continue + return nil } } // Check files matching the included suffixes. @@ -57,6 +57,7 @@ func (l *License) Compliance(options *policy.Options) (report policy.Report) { return nil } ValidateLicenseHeader(&report, info.Name(), contents, []byte(l.Header)) + return nil } } }