Go Project AGENTS.md
RulesAGENTS.md for Go projects — works with Codex, Gemini CLI, and OpenCode.
1903/26/2026
markdown1 file
AGENTS.md860 B
AGENTS.md
Language & Runtime
- Go 1.22+
- Go modules (go.mod at repo root)
Build & Run
go build ./cmd/server # build
go run ./cmd/server # run
go test ./... -race # test with race detector
go vet ./... # static analysis
Code Conventions
- Use gofmt formatting (non-negotiable)
- Error handling: always check returned errors
- Use context.Context for cancellation and timeouts
- Prefer interfaces for testability
- No global state — pass dependencies explicitly
Project Structure
- cmd/ — application entry points
- internal/ — private packages
- pkg/ — public shared packages (if any)
- api/ — OpenAPI specs, proto files
Dependencies
- Minimize external dependencies
- Prefer stdlib over third-party when reasonable
- Pin dependency versions in go.mod
- Run go mod tidy before committing