ax(ueps): replace errors.Is usage examples with direct sentinel comparison
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 2 requires comments to show correct usage patterns.
errMissingHMAC and errIntegrityViolation are tlvError sentinels (comparable
values), so the examples should use == not errors.Is from the banned errors
package.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 09:05:29 +01:00
parent 0c77689877
commit 9dea4d6ac4
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -10,11 +10,11 @@ import (
)
// packet, err := ReadAndVerify(bufio.NewReader(conn), secret)
// if errors.Is(err, errMissingHMAC) { /* no HMAC tag found in frame */ }
// if err == errMissingHMAC { /* no HMAC tag found in frame */ }
var errMissingHMAC = tlvError("UEPS packet missing HMAC signature")
// packet, err := ReadAndVerify(bufio.NewReader(conn), wrongSecret)
// if errors.Is(err, errIntegrityViolation) { /* HMAC mismatch — threat score incremented */ }
// if err == errIntegrityViolation { /* HMAC mismatch — threat score incremented */ }
var errIntegrityViolation = tlvError("integrity violation: HMAC mismatch (ThreatScore +100)")
// packet, err := ueps.ReadAndVerify(bufio.NewReader(conn), sharedSecret)