Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func main() {

// process at most 1000 files in parallel
ch := make(chan *file, 1000)
done := make(chan struct{})
done := make(chan error)
go func() {
var wg errgroup.Group
for f := range ch {
Expand Down Expand Up @@ -133,18 +133,17 @@ func main() {
return nil
})
}
err := wg.Wait()
close(done)
if err != nil {
os.Exit(1)
}
done <- wg.Wait()
}()

for _, d := range flag.Args() {
walk(ch, d)
}
close(ch)
<-done
if err := <-done; err != nil {
fmt.Printf("error: %s\n", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the error paths do a log.Printf already, and it seems weird to print the error to stdout. Is this line needed?

os.Exit(1)
}
}

type file struct {
Expand Down