From eadb73ac0da4c9d89005580c0c9cc1ec8c7bbc8c Mon Sep 17 00:00:00 2001 From: Muhammad Talal Anwar Date: Tue, 21 Jun 2022 02:19:49 +0200 Subject: [PATCH] Only log skipped files in verbose mode --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b2ef240..2ba7ef9 100644 --- a/main.go +++ b/main.go @@ -58,7 +58,7 @@ var ( license = flag.String("l", "apache", "license type: apache, bsd, mit, mpl") licensef = flag.String("f", "", "license file") year = flag.String("y", fmt.Sprint(time.Now().Year()), "copyright year(s)") - verbose = flag.Bool("v", false, "verbose mode: print the name of the files that are modified") + verbose = flag.Bool("v", false, "verbose mode: print the name of the files that are modified or were skipped") checkonly = flag.Bool("check", false, "check only mode: verify presence of license headers and exit with non-zero code if missing") ) @@ -217,7 +217,9 @@ func walk(ch chan<- *file, start string) error { return nil } if fileMatches(path, ignorePatterns) { - log.Printf("skipping: %s", path) + if *verbose { + log.Printf("skipping: %s", path) + } return nil } ch <- &file{path, fi.Mode()}