cmd: gomtree: re-enable errors when there is a Modified entry

Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
Aleksa Sarai 2017-01-14 18:01:21 +11:00
parent 3c76a35588
commit 9cdd9152b3
No known key found for this signature in database
GPG Key ID: 9E18AA267DDB8DB4
1 changed files with 10 additions and 10 deletions

View File

@ -269,14 +269,20 @@ func app() error {
if isTarSpec(specDh) || *flTar != "" {
res = filterMissingKeywords(res)
}
//if len(res) > 0 {
//return fmt.Errorf("unexpected missing keywords: %d", len(res))
//}
out := formatFunc(res)
if _, err := os.Stdout.Write([]byte(out)); err != nil {
return err
}
// TODO: This should be a flag. Allowing files to be added and
// removed and still returning "it's all good" is simply
// unsafe IMO.
for _, diff := range res {
if diff.Type() == mtree.Modified {
return fmt.Errorf("mainfest validation failed")
}
}
}
} else {
return fmt.Errorf("neither validating or creating a manifest. Please provide additional arguments")
@ -289,13 +295,7 @@ var formats = map[string]func([]mtree.InodeDelta) string{
"bsd": func(d []mtree.InodeDelta) string {
var buffer bytes.Buffer
for _, delta := range d {
if delta.Type() == mtree.Modified {
fmt.Fprintln(&buffer, delta)
} else if delta.Type() == mtree.Missing {
fmt.Fprintln(&buffer, delta)
} else if delta.Type() == mtree.Extra {
fmt.Fprintln(&buffer, delta)
}
fmt.Fprintln(&buffer, delta)
}
return buffer.String()
},