goldsmith/file_util.go
2024-02-16 22:27:10 -08:00

24 lines
350 B
Go

package goldsmith
import (
"os"
"path/filepath"
)
type fileInfo struct {
os.FileInfo
path string
}
func scanDir(dir string, infoChan chan fileInfo) {
defer close(infoChan)
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err == nil {
infoChan <- fileInfo{FileInfo: info, path: path}
}
return err
})
}