diff --git a/check.go b/check.go index cdc22f5..1586436 100644 --- a/check.go +++ b/check.go @@ -94,8 +94,7 @@ func check(files []string) chan error { results := []<-chan error{} - workers := 32 - for w := 0; w < workers; w++ { + for w := 0; w < *ngo; w++ { results = append(results, compute(jobs)) } diff --git a/main.go b/main.go index c261dd5..6bd0464 100644 --- a/main.go +++ b/main.go @@ -9,10 +9,12 @@ import ( "fmt" "io" "os" + "runtime" ) var algo = flag.String("a", "sha1", "algorithm to use") var mode = flag.Bool("c", false, "check") +var ngo = flag.Int("n", runtime.NumCPU(), "number of goroutines") func main() { flag.Parse()