Naming, layout and comments: descriptive full-word names, one item per line in wrapped calls and literals, and doc comments on exported names

Short and single-letter names in application code become full words (tests
keep theirs). Wrapped calls, signatures and composite literals put one item
per line, and one-line function bodies are expanded. Exported names and
groups of constants get doc comments, and comments refer to the renamed
identifiers.
This commit is contained in:
bwilliams committed 2026-10-15 16:12:56 +01:00
1 parent 043e307663
commit 465358609a
78 files changed
+2374 -1402

No files matched your search

+7 -2
View File
@@ -178,7 +178,10 @@ func (t *tcpConn) Ping(ctx context.Context) error {
// connection. Only the first Close or CloseNow does anything; later calls
// return nil. A CloseNow while Close is sending its message cuts it short.
func (t *tcpConn) Close(code ws.StatusCode, reason string) error {
if !t.markClosed(ws.CloseError{Code: code, Reason: reason}) {
if !t.markClosed(ws.CloseError{
Code: code,
Reason: reason,
}) {
return nil
}
@@ -206,7 +209,9 @@ func (t *tcpConn) Close(code ws.StatusCode, reason string) error {
// CloseNow closes the connection without a message. It doesn't wait for a
// Close that is sending its message.
func (t *tcpConn) CloseNow() error {
t.markClosed(ws.CloseError{Code: ws.StatusAbnormalClosure})
t.markClosed(ws.CloseError{
Code: ws.StatusAbnormalClosure,
})
if err := t.conn.Close(); err != nil && !errors.Is(err, net.ErrClosed) {
return err
}