var files []string
var my_dir = "../testDir/"
var err = filepath.Walk(my_dir, func(path string, info os.FileInfo, err error) (error) {
if !info.IsDir() {
var ext = filepath.Ext(path)
if ext == ".tx" {
files = append(files, path)
}
}
return nil
})
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
// текущая папка
files, err := ioutil.ReadDir(".")
if err != nil {
log.Fatal(err)
}
for _, file := range files {
fmt.Println(file.Name(), file.IsDir())
}
}