ax(node): replace prose comment with usage example on safeKeyPrefix
AX Principle 2: comments show HOW with real values, not WHAT the signature says. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
c85217dfca
commit
a4c4d64a98
1 changed files with 2 additions and 1 deletions
|
|
@ -56,7 +56,8 @@ const (
|
|||
// peerNameRegex validates peer names: alphanumeric, hyphens, underscores, and spaces
|
||||
var peerNameRegex = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-_ ]{0,62}[a-zA-Z0-9]$|^[a-zA-Z0-9]$`)
|
||||
|
||||
// safeKeyPrefix returns a truncated key for logging, handling short keys safely
|
||||
// safeKeyPrefix("abc123def456xyz789") // "abc123def456xyz7..."
|
||||
// safeKeyPrefix("") // "(empty)"
|
||||
func safeKeyPrefix(key string) string {
|
||||
if len(key) >= 16 {
|
||||
return key[:16] + "..."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue