dir_walker

package
v0.0.0-...-c37dd20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirEntry

type DirEntry struct {
	IsDir bool
	Name  string
}

func ReadDir

func ReadDir(dirPath string) ([]DirEntry, error)

ReadDir does the same as os.ReadDir, but does not sort

Example (Bad)
_, err := ReadDir("dir_that_does_not_exist")
fmt.Println("read dir error:", err)
Output:

read dir error: open dir_that_does_not_exist: no such file or directory
Example (Good)
entries, err := ReadDir("testdata")
fmt.Println("read dir error:", err)
fmt.Printf("%+v\n", entries)
Output:

read dir error: <nil>
[{IsDir:true Name:sub} {IsDir:false Name:1.txt}]

type Walker

type Walker struct {
	ReadDir func(dirPath string) ([]DirEntry, error)
}

func NewWalker

func NewWalker() *Walker

func (*Walker) Walk

func (w *Walker) Walk(dirPath, forbiddenDirPath string, globDir *glob.Dir,
	visitor func(dirPath string, interfaces generator.Interfaces))

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL