walks

package module
v0.0.0-...-4c1a3cb Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 6 Imported by: 3

README

walks

This is a simple Go package, that contains functions to walk directory structure and perform user-defined actions on files and directories.

Download

To get this package, run the following command

go get -v github.com/moledoc/walks

Author

Meelis Utt

Documentation

Index

Constants

This section is empty.

Variables

Ignore is a variable to hold regexp expression of directories and files to ignore.

Search is a variable to hold expressions of directories and files to search.

View Source
var WaitGroup sync.WaitGroup

WaitGroup is a variable to easily handle goroutine waiting.

Functions

func SetIgnore

func SetIgnore(ignFilePath string)

SetIgnore sets global Ignore with the contents of ignore file, where each line represents one file or directory to ignore.

func Walk

func Walk(root string, fileAction func(string), dirAction func(string), depth int)

Walk is a concurrent function that walks recursively given directory structure, performing given actions on files and directories. Actions on files and directories are expected to take the corresponding file/dir path as an argument and not return anything. Directories and files can also be ignored by setting Ignore value with SetIgnore function or manually before Walk call. Depth of directory structure can be controlled with variables depth.

func WalkLinear

func WalkLinear(root string, fileAction func(string), dirAction func(string), depth int, level int)

WalkLinear walks recursively given directory structure, performing given actions on files and directories. Actions on files and directories are expected to take the corresponding file/dir path as an argument and not return anything. Directories and files can also be ignored by setting Ignore value with SetIgnore function or setting it manually. Depth of directory structure can be controlled with variables depth (and level).

Types

This section is empty.

Jump to

Keyboard shortcuts

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