Skip to content

Commit

Permalink
scanner: honor -quiet switch, remove duplicate Seek again.
Browse files Browse the repository at this point in the history
  • Loading branch information
hillu committed Jan 5, 2022
1 parent be5f9a1 commit cbee9c5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions scanner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ func main() {

for _, root := range flag.Args() {
filepath.Walk(filepath.Clean(root), func(path string, info os.FileInfo, err error) error {
fmt.Fprintf(logFile, "examining %s\n", path)
if !quiet {
fmt.Fprintf(logFile, "examining %s\n", path)
}
if err != nil {
fmt.Fprintf(errFile, "%s: %s\n", path, err)
return nil
}
if excludes.Has(path) {
if excludes.Has(path) && !quiet {
fmt.Fprintf(logFile, "Skipping %s\n", path)
return filepath.SkipDir
}
Expand All @@ -169,10 +171,6 @@ func main() {
fmt.Fprintf(errFile, "can't seek in %s: %v\n", path, err)
return nil
}
if _, err := f.Seek(0, os.SEEK_END); err != nil {
fmt.Fprintf(errFile, "can't seek in %s: %v\n", path, err)
return nil
}
handleJar(path, f, sz)
default:
return nil
Expand Down

0 comments on commit cbee9c5

Please sign in to comment.