Only log skipped files in verbose mode

This commit is contained in:
Muhammad Talal Anwar
2022-06-21 02:19:49 +02:00
committed by Will Norris
parent 6c3d2501f2
commit eadb73ac0d

View File

@@ -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()}