From 4e10e20a6b4db79920d3506530773dc4e3a3fa2a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 11:31:36 +0100 Subject: [PATCH] ax(node): replace prose comment with usage example on GetConnection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AX Principle 2 — comments must show HOW with real values, not restate what the signature already says. The old comment described the return value in prose; replaced with a concrete call-site example. Co-Authored-By: Charon --- pkg/node/transport.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/node/transport.go b/pkg/node/transport.go index 3613fcd..e5b0250 100644 --- a/pkg/node/transport.go +++ b/pkg/node/transport.go @@ -404,7 +404,8 @@ func (t *Transport) Broadcast(msg *Message) error { return lastErr } -// GetConnection returns an active connection to a peer. +// conn := transport.GetConnection(peer.ID) +// if conn == nil { return fmt.Errorf("peer not connected") } func (t *Transport) GetConnection(peerID string) *PeerConnection { t.mutex.RLock() defer t.mutex.RUnlock()