1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2025-07-04 06:38:30 +00:00

*: make Keyword and KeyVal pervasive

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-11-17 19:47:31 -05:00
parent 5d26726bb1
commit 4eec68be4b
Signed by: vbatts
GPG key ID: 10937E57733F1362
18 changed files with 434 additions and 367 deletions

View file

@ -28,8 +28,8 @@ func (dh DirectoryHierarchy) WriteTo(w io.Writer) (n int64, err error) {
// UsedKeywords collects and returns all the keywords used in a
// a DirectoryHierarchy
func (dh DirectoryHierarchy) UsedKeywords() []string {
usedkeywords := []string{}
func (dh DirectoryHierarchy) UsedKeywords() []Keyword {
usedkeywords := []Keyword{}
for _, e := range dh.Entries {
switch e.Type {
case FullType, RelativeType, SpecialType:
@ -37,8 +37,8 @@ func (dh DirectoryHierarchy) UsedKeywords() []string {
kvs := e.Keywords
for _, kv := range kvs {
kw := KeyVal(kv).Keyword()
if !inSlice(kw, usedkeywords) {
usedkeywords = append(usedkeywords, KeywordSynonym(kw))
if !InKeywordSlice(kw, usedkeywords) {
usedkeywords = append(usedkeywords, KeywordSynonym(string(kw)))
}
}
}