1
0
Fork 0
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:
Aleksa Sarai 2016-07-27 22:03:43 +10:00
parent 30ae0132eb
commit 36372dd3c8
No known key found for this signature in database
GPG key ID: 9E18AA267DDB8DB4
3 changed files with 23 additions and 36 deletions

View file

@ -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