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
@@ -17,6 +17,8 @@ import (
|
||||
"git.avsdev.uk/Go/job-search/internal/websocket/tcpserver"
|
||||
)
|
||||
|
||||
// NewCommand returns the wsserve command, which runs a plain TCP server for
|
||||
// websocket hub clients (see tcpserver).
|
||||
func NewCommand(opts *cli.Options) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "wsserve",
|
||||
@@ -43,7 +45,7 @@ func NewCommand(opts *cli.Options) *cobra.Command {
|
||||
}
|
||||
i, err := strconv.Atoi(listenParts[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse --listen port: %w", err)
|
||||
return fmt.Errorf("failed to parse --listen port: %w", err)
|
||||
}
|
||||
hostOverride = listenParts[0]
|
||||
portOverride = i
|
||||
@@ -75,9 +77,9 @@ func NewCommand(opts *cli.Options) *cobra.Command {
|
||||
}()
|
||||
|
||||
hub := websocket.NewHub(conf.Server.WebSocket)
|
||||
svr := tcpserver.New(&conf.Server, hub)
|
||||
server := tcpserver.New(&conf.Server, hub)
|
||||
|
||||
return svr.Run(ctx)
|
||||
return server.Run(ctx)
|
||||
},
|
||||
}
|
||||
cmd.Flags().String("listen", "", "listen address (default from config, 127.0.0.1:9393)")
|
||||
|
||||
Reference in new issue
Block a user