Enforce multiline rule for single multiline arguments

Update go-style guide and cursor rule to clarify that even a single
argument spanning multiple lines must break after the opening
parenthesis. Fix six violations across the branch.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 09:47:52 +04:00
parent cfbd761a93
commit 091be2653a
5 changed files with 78 additions and 34 deletions

View File

@@ -106,6 +106,33 @@ t.Run(
svc, err := foo.NewService(ctx, db, logger, foo.Config{
Interval: 10 * time.Second,
})
// Bad — single multiline argument starts on the opening ( line
body, err := json.Marshal(firecrawlRequest{
Query: query,
Limit: maxResults,
})
// Good — single multiline argument: break after (, trailing comma, ) alone
body, err := json.Marshal(
firecrawlRequest{
Query: query,
Limit: maxResults,
},
)
// Bad — function literal starts on the opening ( line
sort.Slice(items, func(i, j int) bool {
return items[i].Name < items[j].Name
})
// Good — function literal on its own line
sort.Slice(
items,
func(i, j int) bool {
return items[i].Name < items[j].Name
},
)
```
The same rule applies to **method calls** `x.M(a1, …)` — the receiver is already bound; the rule applies to the **argument list** after the method name.