mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-01 05:28:30 +00:00
mtree: remove use of dhCreator for iterators
Fix a bug in the parser that caused all iterators to have to handle the /set and /unset semantics separately. In addition, provide a helper function to correctly generate the merged set of keywords for a particular entry. Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
30ae0132eb
commit
36372dd3c8
3 changed files with 23 additions and 36 deletions
13
entry.go
13
entry.go
|
@ -100,6 +100,19 @@ func (e Entry) String() string {
|
|||
return fmt.Sprintf(" %s %s", e.Name, strings.Join(e.Keywords, " "))
|
||||
}
|
||||
|
||||
// AllKeys returns the full set of KeyVals for the given entry, based on the
|
||||
// /set keys as well as the entry-local keys. Entry-local keys always take
|
||||
// precedence.
|
||||
func (e Entry) AllKeys() KeyVals {
|
||||
var kv KeyVals
|
||||
if e.Set != nil {
|
||||
kv = MergeSet(e.Set.Keywords, e.Keywords)
|
||||
} else {
|
||||
kv = NewKeyVals(e.Keywords)
|
||||
}
|
||||
return kv
|
||||
}
|
||||
|
||||
// EntryType are the formats of lines in an mtree spec file
|
||||
type EntryType int
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue