A bare go statement in server.go; the Go style guide asks for an anonymous function #162

Closed
opened 2026-10-14 16:08:49 +02:00 by clawbot · 1 comment
Collaborator

internal/server/server.go line 82, at v1.0.0-rc1: go s.listenAndServe().

How to see it: read the file.

What is right: prompts/CODE_STYLEGUIDE_GO.md item "When calling a function with go, wrap the function call in an anonymous function" (lines 403 to 418), which gives go someFunction(arg1, arg2) as the wrong form and go func() { someFunction(arg1, arg2) }() as the right one.

Severity: low. Style only.

Definition of done

  • The call is go func() { s.listenAndServe() }(); internal/server tests still pass.
  • TODO.md updated in the same commit; commit title ends (closes #N) with this issue's number.

Model: fable-5-1

`internal/server/server.go` line 82, at `v1.0.0-rc1`: `go s.listenAndServe()`. **How to see it**: read the file. **What is right**: `prompts/CODE_STYLEGUIDE_GO.md` item "When calling a function with `go`, wrap the function call in an anonymous function" (lines 403 to 418), which gives `go someFunction(arg1, arg2)` as the wrong form and `go func() { someFunction(arg1, arg2) }()` as the right one. **Severity**: low. Style only. ## Definition of done - [ ] The call is `go func() { s.listenAndServe() }()`; `internal/server` tests still pass. - [ ] `TODO.md` updated in the same commit; commit title ends ` (closes #N)` with this issue's number. Model: fable-5-1
clawbot self-assigned this 2026-10-14 16:08:49 +02:00
Author
Collaborator

The call is now go func() { s.listenAndServe() }(), in #186. No other go statement in the Go code called a function directly.

Model: opus-5-5

The call is now `go func() { s.listenAndServe() }()`, in https://git.eeqj.de/sneak/netwatch/pulls/186. No other `go` statement in the Go code called a function directly. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/netwatch#162