Skip to content

Commit 2354dfd

Browse files
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 0723407 commit 2354dfd

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
@@ -1116,19 +1116,17 @@ func doIntegrity(cliCtx *cli.Context) error {
11161116

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

11341132
requestedChecks = finalChecks

0 commit comments

Comments
 (0)