Skip to content

Commit 597d632

Browse files
Manas Srivastavaclaude
andcommitted
fix(lint): apply De Morgan's law to hex-validation guards (QF1001)
Merging origin/master into the lint branch pulled in two test files (mongo/k8s_test.go, postgres/k8s_helpers_test.go) whose hex-character guards trip staticcheck QF1001 under CI's golangci-lint `latest` (newer than the locally pinned 2.11.4). Rewrite if !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) into the equivalent if (c < '0' || c > '9') && (c < 'a' || c > 'f') Pure boolean equivalence — both packages' tests still pass. Also merges master so the local lint surface matches the pull/16/merge commit CI lints. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2214965 commit 597d632

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

internal/backend/mongo/k8s_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func TestMongoK8sRandHex_LengthAndUniqueness(t *testing.T) {
117117
}
118118
// Hex-only characters.
119119
for _, c := range a {
120-
if !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) {
120+
if (c < '0' || c > '9') && (c < 'a' || c > 'f') {
121121
t.Errorf("non-hex char %q in %q", c, a)
122122
}
123123
}

internal/backend/postgres/k8s_helpers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func TestK8sRandHex(t *testing.T) {
8585
}
8686
// Must be valid hex.
8787
for _, c := range s {
88-
if !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')) {
88+
if (c < '0' || c > '9') && (c < 'a' || c > 'f') {
8989
t.Errorf("k8sRandHex returned non-hex char %q", c)
9090
break
9191
}

0 commit comments

Comments
 (0)