|
| 1 | +# AGENTS.md - Percona ClusterSync for MongoDB |
| 2 | + |
| 3 | +## Build/Lint/Test Commands |
| 4 | +- **Build**: `make build` (production) or `make test-build` (with race detection) |
| 5 | +- **Lint**: `make lint` (uses golangci-lint with gofmt, gofumpt, goimports) |
| 6 | +- **Test Go**: `go test -race ./...` or `make test` |
| 7 | +- **Test Python**: `poetry run pytest` or `make pytest` |
| 8 | +- **Single Go Test**: `go test -race -run TestName ./package` |
| 9 | +- **Single Python Test**: `poetry run pytest tests/test_file.py::test_name` |
| 10 | +- **Clean**: `make clean` |
| 11 | + |
| 12 | +## Code Style Guidelines |
| 13 | +- **Imports**: Group stdlib, third-party, local (separated by blank lines). Use `goimports` for formatting. |
| 14 | +- **Error Handling**: Use custom `errors` package (`errors.Wrap`, `errors.New`, `errors.Join`). Always wrap errors with context. Return `nil` for nil errors in Wrap. |
| 15 | +- **Types**: Prefer explicit types. Use generics where appropriate. Document exported types with comments. |
| 16 | +- **Naming**: Use camelCase for unexported, PascalCase for exported. Acronyms stay uppercase (e.g., `URI`, `HTTP`). |
| 17 | +- **Comments**: Document all exported functions/types with godoc format. Start with the function/type name. |
| 18 | +- **Linting**: Follow golangci-lint v2 with most linters enabled (see `.golangci.yml`). Use `//nolint:lintername` sparingly with justification. |
| 19 | +- **Context**: Pass `context.Context` as first parameter. Use `util.CtxWithTimeout` for timeout operations. |
| 20 | +- **Formatting**: Use `gofmt` and `gofumpt`. Max line length flexible but keep readable. Use tabs for indentation. |
| 21 | +- **Testing**: Use `testify` for assertions. Add `-race` flag. Python tests use `pytest` with `pymongo`. |
0 commit comments