From 8d0ecfdc7f4191628f1a5cb377a45f8e31170884 Mon Sep 17 00:00:00 2001 From: "Stephen McQuay (smcquay)" Date: Tue, 15 Nov 2016 21:02:03 -0800 Subject: [PATCH] speed things up (silence is golden) --- check.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/check.go b/check.go index 7820a39..cdc22f5 100644 --- a/check.go +++ b/check.go @@ -94,7 +94,7 @@ func check(files []string) chan error { results := []<-chan error{} - workers := 8 + workers := 32 for w := 0; w < workers; w++ { results = append(results, compute(jobs)) } @@ -140,12 +140,11 @@ func compute(jobs chan work) chan error { continue } if _, err := io.Copy(job.cs.hash, f); err != nil { - log.Printf("%+v", err) + r <- err + continue } f.Close() - if fmt.Sprintf("%x", job.cs.hash.Sum(nil)) == job.cs.checksum { - fmt.Printf("%s: OK\n", job.cs.filename) - } else { + if fmt.Sprintf("%x", job.cs.hash.Sum(nil)) != job.cs.checksum { r <- fmt.Errorf("%s: bad", job.cs.filename) } }