Version Cursor rules

Track .cursor/rules/ in git so coding conventions are shared
across the team. Everything else under .cursor/ stays ignored.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 14:10:39 +04:00
parent 58d3ba3823
commit 8f8f09008a
16 changed files with 687 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
---
description: Go URL construction — never use fmt.Sprintf or concatenation for URLs
globs: "**/*.go"
alwaysApply: false
---
# Go URL and query parameter construction
**Never** build URLs with `fmt.Sprintf`, string concatenation, or any string formatting.
Use `net/url` package or `pkg/baseurl.URLBuilder`.
```go
// BAD
endpoint := fmt.Sprintf("https://api.example.com/users/%s?active=%t", userID, active)
endpoint := "https://api.example.com/orgs/" + orgID + "/members"
raw := baseEndpoint + "?domain=" + domain + "&limit=100"
// GOOD — url.JoinPath + url.Values
u, err := url.JoinPath("https://api.example.com", "users", userID)
if err != nil {
return fmt.Errorf("cannot build URL: %w", err)
}
parsed, err := url.Parse(u)
if err != nil {
return fmt.Errorf("cannot parse URL: %w", err)
}
q := parsed.Query()
q.Set("active", strconv.FormatBool(active))
parsed.RawQuery = q.Encode()
// GOOD — URLBuilder from pkg/baseurl
u, err := baseURL.URL("/users", userID).
Query("active", strconv.FormatBool(active)).
Build()
```