Skip to content

Commit 759a7d5

Browse files
AskAlexSharovsudeepdino008
authored andcommitted
integrity: --skip-check support (#19598)
The fix iterates over requestedChecks (not the skip list) and excludes anything in the skip set. Before, it was iterating over skip entries and only keeping ones not found in the requested list — the exact opposite of what's needed.
1 parent 83b0547 commit 759a7d5

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

cmd/utils/app/snapshots_cmd.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,19 +1117,17 @@ func doIntegrity(cliCtx *cli.Context) error {
11171117

11181118
skipChecks := cliCtx.String("skip-check")
11191119
if len(skipChecks) > 0 {
1120-
var finalChecks []integrity.Check
1120+
skipSet := map[integrity.Check]struct{}{}
11211121
for skipCheck := range strings.SplitSeq(skipChecks, ",") {
1122-
found := false
1123-
for _, chk := range requestedChecks {
1124-
if chk == integrity.Check(skipCheck) {
1125-
found = true
1126-
logger.Info("[integrity] skipping check", "check", chk)
1127-
break
1128-
}
1129-
}
1130-
if !found {
1131-
finalChecks = append(finalChecks, integrity.Check(skipCheck))
1122+
skipSet[integrity.Check(skipCheck)] = struct{}{}
1123+
}
1124+
var finalChecks []integrity.Check
1125+
for _, chk := range requestedChecks {
1126+
if _, skip := skipSet[chk]; skip {
1127+
logger.Info("[integrity] skipping check", "check", chk)
1128+
continue
11321129
}
1130+
finalChecks = append(finalChecks, chk)
11331131
}
11341132

11351133
requestedChecks = finalChecks

0 commit comments

Comments
 (0)