1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2025-07-03 22:28:29 +00:00

*.go: go-staticcheck linting

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2022-04-08 22:47:26 -04:00
parent 4760b77e54
commit 3bc8e48538
Signed by: vbatts
GPG key ID: 10937E57733F1362
6 changed files with 6 additions and 42 deletions

26
tar.go
View file

@ -373,7 +373,6 @@ func flatten(root *Entry, creator *dhCreator, keywords []Keyword) {
}
creator.DH.Entries = append(creator.DH.Entries, dotEntry)
}
return
}
// resolveHardlinks goes through an Entry tree, and finds the Entry's associated
@ -409,31 +408,6 @@ func resolveHardlinks(root *Entry, hardlinks map[string][]string, countlinks boo
}
}
// filter takes in a pointer to an Entry, and returns a slice of Entry's that
// satisfy the predicate p
func filter(root *Entry, p func(*Entry) bool) []Entry {
if root != nil {
var validEntrys []Entry
if len(root.Children) > 0 || root.Prev != nil {
for _, c := range root.Children {
// filter the sub-directory
if c.Prev != nil {
validEntrys = append(validEntrys, filter(c, p)...)
}
if p(c) {
if c.Prev == nil {
validEntrys = append([]Entry{*c}, validEntrys...)
} else {
validEntrys = append(validEntrys, *c)
}
}
}
return validEntrys
}
}
return nil
}
func (ts *tarStream) setErr(err error) {
ts.err = err
}