chore: add GitHub Copilot instructions#1438
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a repository-specific .github/copilot-instructions.md to guide GitHub Copilot’s PR reviews and code generation for goravel/framework, with emphasis on Go style, error-handling conventions, and where to find detailed testing guidance.
Changes:
- Introduces Copilot guidance for Go code style (e.g.,
any, import grouping, shadowing guidance). - Documents error-handling expectations (sentinel errors, module tagging,
.Args(...)formatting). - Links to the existing test guidelines at
.agents/prompts/tests.md.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1438 +/- ##
==========================================
+ Coverage 68.78% 68.79% +0.01%
==========================================
Files 361 361
Lines 27829 27833 +4
==========================================
+ Hits 19141 19147 +6
+ Misses 7840 7839 -1
+ Partials 848 847 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a repository-scoped instruction file intended to steer GitHub Copilot reviews and code generation toward goravel/framework conventions (Go style, framework error patterns, and testing guidance).
Changes:
- Added
.github/copilot-instructions.mddocumenting Go code style rules (e.g.,any, import grouping, shadowing guidance). - Documented framework error handling conventions (sentinel errors, module tagging,
.Args(...)usage). - Linked to
.agents/prompts/tests.mdfor the full testing guidelines.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ## Error Handling | ||
|
|
||
| - All sentinel errors must be declared in `errors/list.go` using the framework error constructor: `github.com/goravel/framework/errors.New(...)` (or unqualified `New(...)` when inside `package errors`). Do not create ad-hoc `fmt.Errorf` errors for domain errors. |
|
|
||
| - All sentinel errors must be declared in `errors/list.go` using the framework error constructor: `github.com/goravel/framework/errors.New(...)` (or unqualified `New(...)` when inside `package errors`). Do not create ad-hoc `fmt.Errorf` errors for domain errors. | ||
| - Tag errors with a module via `.SetModule(errors.ModuleXxx)` when returning from a service provider or internal package. | ||
| - Use format verbs in error messages and supply dynamic parts via `.Args(...)` — never interpolate directly into the `New` string. |
Summary
.github/copilot-instructions.mdwith Go code style, error handling, and testing rules for GitHub Copilotanyoverinterface{}, and sentinel error declaration patterns.agents/prompts/tests.mdfor the full testing guidelinesWhy
The repository had no structured file to guide GitHub Copilot when reviewing or generating code for
goravel/framework. Without it, Copilot suggestions could diverge from the project's established conventions around error handling, code style, and testing.Adding
.github/copilot-instructions.mddocuments the key rules in one place — Go style (useany, import order, no variable shadowing), error handling (sentinel errors inerrors/list.go, module tagging, no silent swallowing), and a pointer to the full testing guide — so that Copilot's review feedback and code suggestions stay consistent with project standards.