-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Move bindings to config #865
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.15.x #865 +/- ##
==========================================
Coverage ? 69.79%
==========================================
Files ? 218
Lines ? 18890
Branches ? 0
==========================================
Hits ? 13184
Misses ? 4991
Partials ? 715 ☔ View full report in Codecov by Sentry. |
Thanks for your PR, could you add more descriptions or examples for this requirement? To explain what the goal of this PR is. |
@hwbrzzl added sample with, without PR updates |
config/binding.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean removing unused service_providers from config/app.go
? Yes, this PR should optimize that situation, great catch! How about moving this file to contracts/binding.go
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's better there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR
type ServiceProvider struct { | ||
} | ||
|
||
func (database *ServiceProvider) Register(app foundation.Application) { | ||
app.BindWith(BindingAuth, func(app foundation.Application, parameters map[string]any) (any, error) { | ||
func (auth *ServiceProvider) Register(app foundation.Application) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
📑 Description
Closes https://github.com/goravel/goravel/issues/?
Normal binding for internal packages will include the package even we never registered it in app because of Make func in container which make the output file larger, so we need a diff. way to bind these packages and keep Make functions in container
@coderabbitai summary
fresh goravl contains all service providers
➜ goravel git:(v1.15.x) ✗ go build -o goravel main.go ➜ goravel git:(v1.15.x) ✗ ll total 152304 -rw-r--r--@ 1 ahmed3mar staff 550B Feb 7 10:01 Dockerfile -rw-r--r--@ 1 ahmed3mar staff 1.0K Feb 7 10:01 LICENSE -rw-r--r--@ 1 ahmed3mar staff 9.2K Feb 7 10:01 README.md -rw-r--r--@ 1 ahmed3mar staff 9.0K Feb 7 10:01 README_zh.md drwxr-xr-x@ 7 ahmed3mar staff 224B Feb 7 10:01 app drwxr-xr-x@ 3 ahmed3mar staff 96B Feb 7 10:01 bootstrap drwxr-xr-x@ 16 ahmed3mar staff 512B Feb 7 10:01 config drwxr-xr-x@ 5 ahmed3mar staff 160B Feb 7 10:01 database -rw-r--r--@ 1 ahmed3mar staff 114B Feb 7 10:01 docker-compose.yml -rw-r--r--@ 1 ahmed3mar staff 9.9K Feb 8 02:57 go.mod -rw-r--r--@ 1 ahmed3mar staff 111K Feb 8 02:57 go.sum -rwxr-xr-x@ 1 ahmed3mar staff 74M Feb 8 12:35 goravel # <--- 74MB -rw-r--r--@ 1 ahmed3mar staff 707B Feb 7 10:01 main.go drwxr-xr-x 5 ahmed3mar staff 160B Feb 7 11:45 packages drwxr-xr-x@ 3 ahmed3mar staff 96B Feb 7 10:01 public drwxr-xr-x@ 3 ahmed3mar staff 96B Feb 7 10:01 resources drwxr-xr-x@ 5 ahmed3mar staff 160B Feb 7 10:01 routes drwxr-xr-x@ 4 ahmed3mar staff 128B Feb 7 10:01 storage drwxr-xr-x@ 4 ahmed3mar staff 128B Feb 7 10:01 tests
with flags
-s -w
but if we need to use goravel for example only with log, console, http, route and gin only and our project doesn't need for database or queue system or others
normal
with move binding to external not inside same package
the size of output file is decreased from 39MB to 22MB
✅ Checks