ax(ueps): replace errors.Is usage examples with direct sentinel comparison
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:
parent
0c77689877
commit
9dea4d6ac4
1 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue