|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `cmd/` entrypoints for CNI plugin, controller, daemon, and helpers; binaries land in `dist/images/` via Make targets. |
| 5 | +- `pkg/` shared Go libraries; `fastpath/` and `versions/` hold data-plane helpers and release metadata. |
| 6 | +- `charts/` Helm chart, `yamls/` and top-level `*-sa.yaml` manifest examples; `docs/` product docs. |
| 7 | +- `hack/` CI/dev scripts; `makefiles/` split build/test logic; `test/` contains `unittest`, `e2e`, `performance`, and fixtures. |
| 8 | + |
| 9 | +## Build, Test, and Development Commands |
| 10 | +- `make build-go` – tidy modules and compile Go binaries for linux/amd64 into `dist/images/`. |
| 11 | +- `make lint` – run `golangci-lint` plus Go “modernize”; auto-fixes when not in CI. |
| 12 | +- `make ut` – run unit tests: Ginkgo suites in `test/unittest` and `go test` with coverage for `pkg`. |
| 13 | + |
| 14 | +## General Coding Guidlines |
| 15 | +- Every time after editing code. MUST run `make lint` to detect and fix potential lint issues. |
| 16 | +- When modifying code, try to clean up any related code logic that is no longer needed. |
| 17 | +- Follow `CODE_STYLE.md`: camelCase identifiers, keep functions short (~100 lines), return/log errors instead of discarding, and prefer `if err := ...; err != nil` patterns. |
| 18 | + |
| 19 | +## Adding a New Feature |
| 20 | +- Plan first: clarify any uncertainties and confirm the approach before making changes. |
| 21 | +- Add unit tests to cover the new feature. |
| 22 | +- When adding end-to-end (e2e) tests for the new feature, use `f.SkipVersionPriorTo` to ensure they run only on supported branches. |
| 23 | + |
| 24 | +## Fixing a Bug |
| 25 | +- Analyze the issue first and identify the root cause. Confirm the analysis before making edits. |
| 26 | +- Check if the same bug pattern exists elsewhere in the codebase. |
0 commit comments