Skip to content

Commit

Permalink
Dedup code a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
s-l-teichmann committed Aug 23, 2023
1 parent 1281543 commit 4dfa2dd
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cmd/csaf_checker/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1131,18 +1131,19 @@ func (p *processor) checkMissing(string) error {
}
}
// List error in all appropriate categories
if mistake&rolieMask != 0 {
p.badROLIEFeed.error("%s %s", f, strings.Join(where, ", "))
}
if mistake&indexMask != 0 {
p.badIndices.error("%s %s", f, strings.Join(where, ", "))
}
if mistake&changesMask != 0 {
p.badChanges.error("%s %s", f, strings.Join(where, ", "))
if mistake&(rolieMask|indexMask|changesMask|listingMask) == 0 {
continue
}
if mistake&listingMask != 0 {
p.badDirListings.error("%s %s", f, strings.Join(where, ", "))
joined := strings.Join(where, ", ")
report := func(mask whereType, msgs *topicMessages) {
if mistake&mask != 0 {
msgs.error("%s %s", f, joined)
}
}
report(rolieMask, &p.badROLIEFeed)
report(indexMask, &p.badIndices)
report(changesMask, &p.badChanges)
report(listingMask, &p.badDirListings)
}
return nil
}
Expand Down

0 comments on commit 4dfa2dd

Please sign in to comment.