ax(node): rename single-letter goroutine parameter p to connectedPeer
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 1: predictable names over short names. The goroutine
parameter in GetAllStats used `p *Peer` — a single-letter abbreviation
with no justification under the AX exception list (i, _, t, c only).
Renamed to `connectedPeer` to match the variable's semantic role.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 09:41:18 +01:00
parent 271f3c2580
commit cbc876fdaf
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -255,19 +255,19 @@ func (c *Controller) GetAllStats() map[string]*StatsPayload {
for _, peer := range peers {
waitGroup.Add(1)
go func(p *Peer) {
go func(connectedPeer *Peer) {
defer waitGroup.Done()
stats, err := c.GetRemoteStats(p.ID)
stats, err := c.GetRemoteStats(connectedPeer.ID)
if err != nil {
logging.Debug("failed to get stats from peer", logging.Fields{
"peer_id": p.ID,
"peer": p.Name,
"peer_id": connectedPeer.ID,
"peer": connectedPeer.Name,
"error": err.Error(),
})
return // Skip failed peers
}
resultsMutex.Lock()
results[p.ID] = stats
results[connectedPeer.ID] = stats
resultsMutex.Unlock()
}(peer)
}