mirror of
https://github.com/vbatts/tar-split.git
synced 2024-11-16 13:28:37 +00:00
Merge pull request #19 from stephen679/check_valid_keyword
check: error out on unrecognized keyword
This commit is contained in:
commit
818b9227d7
1 changed files with 3 additions and 3 deletions
6
check.go
6
check.go
|
@ -63,13 +63,13 @@ func Check(root string, dh *DirectoryHierarchy, keywords []string) (*Result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, kv := range kvs {
|
for _, kv := range kvs {
|
||||||
if keywords != nil && !inSlice(kv.Keyword(), keywords) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
keywordFunc, ok := KeywordFuncs[kv.Keyword()]
|
keywordFunc, ok := KeywordFuncs[kv.Keyword()]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("Unknown keyword %q for file %q", kv.Keyword(), e.Path())
|
return nil, fmt.Errorf("Unknown keyword %q for file %q", kv.Keyword(), e.Path())
|
||||||
}
|
}
|
||||||
|
if keywords != nil && !inSlice(kv.Keyword(), keywords) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
curKeyVal, err := keywordFunc(filepath.Join(root, e.Path()), info)
|
curKeyVal, err := keywordFunc(filepath.Join(root, e.Path()), info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue