Conversation
ff0b8f8 to
bf16451
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1292 +/- ##
==========================================
- Coverage 69.01% 68.82% -0.19%
==========================================
Files 278 278
Lines 16071 16114 +43
==========================================
Hits 11091 11091
- Misses 4506 4549 +43
Partials 474 474 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the framework to replace hardcoded file paths with configurable paths using a new Paths abstraction. The change enables greater flexibility for users to customize their project structure.
Key Changes
- Introduces new
PathsandPathinterfaces incontracts/packages/setup.goto provide structured access to package paths and imports - Replaces
setup.ModulePath()andsetup.PackageName()methods with a unifiedsetup.Paths()API - Moves path utility functions from
support/variable.gotosupport/path/internals/path.gofor better organization - Updates all setup and stub files across packages to use dynamic package names instead of hardcoded "facades" package references
Reviewed changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/packages/setup.go | Adds new Paths, Path interfaces to replace string-based path methods |
| packages/paths.go | New file implementing path abstractions for different package types |
| packages/setup.go | Replaces ModulePath()/PackageName() with Paths() method |
| support/variable.go | Removes PathToSlice() and PathPackage() helper functions |
| support/path/internals/path.go | Adds ToSlice() function (moved from support/variable.go) |
| foundation/application.go | Updates to use internals.ToSlice() instead of support.PathToSlice() |
| view/view.go | Uses support.Config.Paths.Resources instead of hardcoded "resources" |
| support/env/env.go | Uses support.Config.Paths.Bootstrap instead of hardcoded "bootstrap" |
| translation/service_provider.go | Uses configurable lang path with fallback to support.Config.Paths.Lang |
| */setup/stubs.go | Updates stub generators to accept dynamic package names as parameters |
| */setup/setup.go | Updates all setup files to use new Paths() API for package resolution |
| mocks/packages/*.go | Regenerated mocks for updated interfaces |
| support/variable_test.go | Test moved to support/path/internals/path_test.go |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| content = strings.ReplaceAll(content, "DummyPackage", pkg) | ||
| content = strings.ReplaceAll(content, "DummyModule", main) |
There was a problem hiding this comment.
The variable 'DummyModule' is being replaced with 'main' instead of 'DummyMain'. This is inconsistent with the naming convention used throughout the rest of the PR where 'DummyMain' is the placeholder for the main package import. The replacement should use 'DummyMain' as the placeholder.
📑 Description
Related Issue: goravel/goravel#423
This pull request refactors the setup and stub generation logic for several framework packages to use a new, more flexible path abstraction. It replaces direct usage of module and package names with a unified
Pathsinterface, improving maintainability and reducing hardcoded paths throughout the codebase. Additionally, stub functions are updated to accept package names as arguments, allowing for more dynamic and accurate code generation.Refactoring to use new path abstraction:
auth,cache,crypt,database,event) to usesetup.Paths()for retrieving module imports and package names, replacing previous usage ofsetup.ModulePath()andsetup.PackageName(). This ensures consistent and accurate path handling across all packages. [1] [2] [3] [4] [5]Setupinterface incontracts/packages/setup.goto introducePaths,Path, and related methods, providing a structured way to access different package paths and names.Stub generation improvements:
Config,AuthFacade,GateFacade,CryptFacade,DBFacade,OrmFacade,SchemaFacade,SeederFacade) to accept package names as arguments and to dynamically replace placeholders, enabling more flexible and correct stub code generation. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Code cleanup and test adjustments:
Configuration and provider registration updates:
These changes collectively improve the maintainability, flexibility, and correctness of the setup and stub generation processes across the framework.
✅ Checks