Loading internal/pkg/filediscovery/findfiles.go +11 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,10 @@ import ( "io" "log" "os" "path/filepath" "sync" //"path/filepath" "github.com/MichaelTJones/walk" ) var ( Loading Loading @@ -38,6 +41,8 @@ type Status struct { Contents map[HashArray]FileDatas } var m sync.Mutex // FindFiles searches for files at the specific path. func FindFiles(path string) (*Status, error) { Loading @@ -45,7 +50,7 @@ func FindFiles(path string) (*Status, error) { status.Contents = make(map[HashArray]FileDatas, 0) err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error { err := walk.Walk(path, func(path string, info os.FileInfo, err error) error { if err != nil { status.NumberOfErrors++ return err Loading @@ -70,12 +75,14 @@ func FindFiles(path string) (*Status, error) { Info: info, } m.Lock() entries := status.Contents[hash] if entries == nil { entries = make(FileDatas, 0) } entries = append(entries, entry) status.Contents[hash] = entries m.Unlock() return nil }) Loading Loading @@ -113,5 +120,7 @@ func hashFile(filename string) (HashArray, error) { ha[i] = t[i] } //f.Close() return ha, nil } Loading
internal/pkg/filediscovery/findfiles.go +11 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,10 @@ import ( "io" "log" "os" "path/filepath" "sync" //"path/filepath" "github.com/MichaelTJones/walk" ) var ( Loading Loading @@ -38,6 +41,8 @@ type Status struct { Contents map[HashArray]FileDatas } var m sync.Mutex // FindFiles searches for files at the specific path. func FindFiles(path string) (*Status, error) { Loading @@ -45,7 +50,7 @@ func FindFiles(path string) (*Status, error) { status.Contents = make(map[HashArray]FileDatas, 0) err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error { err := walk.Walk(path, func(path string, info os.FileInfo, err error) error { if err != nil { status.NumberOfErrors++ return err Loading @@ -70,12 +75,14 @@ func FindFiles(path string) (*Status, error) { Info: info, } m.Lock() entries := status.Contents[hash] if entries == nil { entries = make(FileDatas, 0) } entries = append(entries, entry) status.Contents[hash] = entries m.Unlock() return nil }) Loading Loading @@ -113,5 +120,7 @@ func hashFile(filename string) (HashArray, error) { ha[i] = t[i] } //f.Close() return ha, nil }