This commit is contained in:
Meutel 2017-07-08 16:50:08 +02:00
parent db3d0426ee
commit 78d5ca23a3

View File

@ -29,8 +29,7 @@ func main() {
for i := 0; i < 100; i++ { for i := 0; i < 100; i++ {
go func() { go func() {
for { for path := range chan_path {
path := <-chan_path
if h, err := sha256File(path); err != nil { if h, err := sha256File(path); err != nil {
wg.Done() wg.Done()
log.Print("Error "+path, err) log.Print("Error "+path, err)
@ -42,14 +41,14 @@ func main() {
} }
go func() { go func() {
for { for h := range chan_hash {
fmt.Println(<-chan_hash) fmt.Println(h)
wg.Done() wg.Done()
} }
}() }()
err := filepath.Walk(os.Args[1], func(path string, info os.FileInfo, err error) error { 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) wg.Add(1)
chan_path <- path chan_path <- path
} }