package eliofile import ( "fmt" "log" "os" "strings" ) type ElioDateiFoo struct { process func(file string) dir string } func NewElioDateiFoo(dir string) *ElioDateiFoo { df := ElioDateiFoo{dir: dir, process: func(file string) { fmt.Println(file) }, } return &df } func (f *ElioDateiFoo) ScanCsv() { files, err := os.ReadDir(f.dir) if err != nil { log.Fatal(err) } for _, file := range files { if strings.Contains(file.Name(), "csv") { f.process(file.Name()) } } }