Skip to content

minodisk/go-walker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-walker Circle CI

Walk a directory recursively in Go.

Installation

go get gopkg.in/minodisk/go-walker.v1

Usage

Walk

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
}

Find files

import "gopkg.in/minodisk/go-walker.v1"

func main() {
  filenames, err := walker.FindFiles("fixtures")
  if err != nil {
    panic(err)
  }
  // do something
}

Reference

http://godoc.org/gopkg.in/minodisk/go-walker.v1