Cursor Rules .mdc
Production-Ready Rule • **/*.go

Golang & Gin/Chi Microservices .cursorrules (.mdc)

Production-tested .cursorrules and .cursor/rules/*.mdc configuration for Golang. Enforce idiomatic error handling, context propagation, and zero-allocation struct discipline.

.cursor/rules/golang.mdc
⚡ Open in Generator
---
description: Idiomatic Golang standards, error wrapping, and context propagation
globs: **/*.go
alwaysApply: false
---

# Golang Engineering Standards

## Error Handling & Reliability
- Handle errors immediately where they occur: `if err != nil { return fmt.Errorf("action failed: %w", err) }`.
- Never ignore errors with `_`. Always handle or explicitly log with justification.
- Wrap errors using `%w` to preserve the causal error chain.

## Concurrency & Context
- Pass `ctx context.Context` as the very first parameter to any function doing I/O.
- Always release resources using `defer resp.Body.Close()` or `defer rows.Close()` immediately after checking for errors.
- Never start unmanaged goroutines without `sync.WaitGroup` or cancellation signals.
⭐ Using this rule in your open-source project? Reference in your README: https://cursor.pacebowl.com/rules/golang.html

Frequently Asked Questions & Implementation Notes

How does it handle Go error handling?

It strictly enforces the idiomatic 'if err != nil' check immediately after function calls with wrapped context errors using fmt.Errorf('...: %w', err).

Does it handle context.Context?

Yes, context.Context must be the first parameter for all database queries and external RPC calls, preventing hanging connections.

PaceBowl Suite Matrix

Mothership Hub →
CF
ComfyUI Prompt Studio

Flux.1 & 1MP Empty Latent calculator.

🔥
AI Radar & Hotlist

24/7 automated tech intel & papers.

GEO
OpenGEO Attribution

Track Perplexity & ChatGPT conversions.