func main() { runtime.GOMAXPROCS(runtime.NumCPU()) filepath.Walk("./save", func(path string, info os.FileInfo, err error) error { var newFile dffiles.File if !info.IsDir() { newFile.Name = info.Name() newFile.Path = path fileList = append(fileList, newFile) } return nil }) for key := range fileList { wg.Add(1) go testFile(&fileList[key]) } wg.Wait() printFinal() }
func testFile(f *dffiles.File) { defer wg.Done() f.HashValue = f.CheckFile() }