Skip to content

Commit

Permalink
Exchange slice with util.set for mistakes in checkMissing
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHoefelmeyer committed Aug 23, 2023
1 parent 7651dc2 commit 4b56f3e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cmd/csaf_checker/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"net/url"
"path/filepath"
"regexp"
"slices"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -1117,7 +1116,7 @@ func (p *processor) checkMissing(string) error {
v := p.alreadyChecked[f]
var where []string
// mistake contains which requirements are broken
var mistake []string
mistake := util.Set[whereType]{}
for mask := rolieMask; mask <= listingMask; mask <<= 1 {
if maxMask&mask == mask {
var in string
Expand All @@ -1126,22 +1125,22 @@ func (p *processor) checkMissing(string) error {
} else {
in = "not in"
// Which file is missing entries?
mistake = append(mistake, mask.String())
mistake.Add(mask)
}
where = append(where, in+" "+mask.String())
}
}
// List error in all appropriate categories
if slices.Contains(mistake, "ROLIE") {
if mistake.Contains(rolieMask) {
p.badROLIEFeed.error("%s %s", f, strings.Join(where, ", "))
}
if slices.Contains(mistake, "index.txt") {
if mistake.Contains(indexMask) {
p.badIndices.error("%s %s", f, strings.Join(where, ", "))
}
if slices.Contains(mistake, "changes.csv") {
if mistake.Contains(changesMask) {
p.badChanges.error("%s %s", f, strings.Join(where, ", "))
}
if slices.Contains(mistake, "directory listing") {
if mistake.Contains(listingMask) {
p.badDirListings.error("%s %s", f, strings.Join(where, ", "))
}
// reset mistake
Expand Down

0 comments on commit 4b56f3e

Please sign in to comment.