mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-03 14:28:28 +00:00
check: an initial pass at a validation check
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
6db2f462a1
commit
2fd41fb43f
5 changed files with 101 additions and 13 deletions
7
walk.go
7
walk.go
|
@ -20,9 +20,9 @@ type dhCreator struct {
|
|||
|
||||
var defaultSetKeywords = []string{"type=file", "nlink=1", "flags=none", "mode=0664"}
|
||||
|
||||
//
|
||||
// To be able to do a "walk" that produces an outcome with `/set ...` would
|
||||
// need a more linear walk, which this can not ensure.
|
||||
// Walk from root directory and assemble the DirectoryHierarchy. excludes
|
||||
// provided are used to skip paths. keywords are the set to collect from the
|
||||
// walked paths. The recommended default list is DefaultKeywords.
|
||||
func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHierarchy, error) {
|
||||
creator := dhCreator{DH: &DirectoryHierarchy{}}
|
||||
// TODO insert signature and metadata comments first (user, machine, tree, date)
|
||||
|
@ -107,6 +107,7 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
|
|||
e := Entry{
|
||||
Name: filepath.Base(path),
|
||||
Pos: len(creator.DH.Entries),
|
||||
Type: RelativeType,
|
||||
Set: creator.curSet,
|
||||
Parent: creator.curDir,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue