From 78d5ca23a37df9a1f48f1aa22e89b3a9223a5b8e Mon Sep 17 00:00:00 2001 From: Meutel Date: Sat, 8 Jul 2017 16:50:08 +0200 Subject: [PATCH] Fix --- shadirconcurrent/main.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/shadirconcurrent/main.go b/shadirconcurrent/main.go index 0240845..e673806 100644 --- a/shadirconcurrent/main.go +++ b/shadirconcurrent/main.go @@ -29,8 +29,7 @@ func main() { for i := 0; i < 100; i++ { go func() { - for { - path := <-chan_path + for path := range chan_path { if h, err := sha256File(path); err != nil { wg.Done() log.Print("Error "+path, err) @@ -42,14 +41,14 @@ func main() { } go func() { - for { - fmt.Println(<-chan_hash) + for h := range chan_hash { + fmt.Println(h) wg.Done() } }() err := filepath.Walk(os.Args[1], func(path string, info os.FileInfo, err error) error { - if err != nil && !info.IsDir() { + if err == nil && !info.IsDir() { wg.Add(1) chan_path <- path }