Walk a directory recursively in Go.
go get gopkg.in/minodisk/go-walker.v1
import (
"os"
"gopkg.in/minodisk/go-walker.v1"
)
func main() {
isFile = false
err := walker.Walk(func (name string, fi os.FileInfo) (bool, error) {
if !fi.IsDir() && name == "target/file" {
isFile = true
return false, nil
}
return true, nil
})
// do something
}
import "gopkg.in/minodisk/go-walker.v1"
func main() {
filenames, err := walker.FindFiles("fixtures")
if err != nil {
panic(err)
}
// do something
}