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:
1 parent
043e307663
commit
465358609a
78 files changed
+2374
-1402
No files matched your search
@@ -30,16 +30,16 @@ func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
ip := middleware.ClientIP(r)
|
||||
ctx, cancel := context.WithCancel(r.Context())
|
||||
c := newClient(h, conn, ip, cancel)
|
||||
client := newClient(h, conn, ip, cancel)
|
||||
|
||||
if !h.register(c) {
|
||||
if !h.register(client) {
|
||||
cancel()
|
||||
conn.Close(ws.StatusGoingAway, "server shutting down") //nolint:errcheck,gosec // turned away
|
||||
return
|
||||
}
|
||||
defer h.unregister(c)
|
||||
defer h.unregister(client)
|
||||
|
||||
h.logger().Info("client connected", "client", c.id, "ip", ip)
|
||||
c.run(ctx)
|
||||
h.logger().Info("client disconnected", "client", c.id, "ip", ip)
|
||||
h.logger().Info("client connected", "client", client.id, "ip", ip)
|
||||
client.run(ctx)
|
||||
h.logger().Info("client disconnected", "client", client.id, "ip", ip)
|
||||
}
|
||||
Reference in new issue
Block a user