-
Notifications
You must be signed in to change notification settings - Fork 929
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
refactor(cluster): refactor cluster package #1507
Conversation
Codecov Report
@@ Coverage Diff @@
## 3.0 #1507 +/- ##
==========================================
- Coverage 42.03% 41.86% -0.18%
==========================================
Files 262 259 -3
Lines 15171 15109 -62
==========================================
- Hits 6377 6325 -52
+ Misses 8054 8049 -5
+ Partials 740 735 -5
Continue to review full report at Codecov.
|
有两个小疑问:
|
我个人认为不会,因为对外访问一般是通过 extension.GetCluster 函数,该函数返回的是一个 cluster.Cluster 的 interface,用户需要通过 interface 再找到相应的 cluster 定义,一般不会直接使用 xxxCluster(Invoker 同理,一般都会先定位到 interface)。在现有目录下,每种 cluster 的结构和定义都更加清晰,且有更良好的扩充性,这是我想要做这次重构的初衷。
是的,Golang 中 |
第一个我指的场景就是指 interface 跳转到实现的时候,之前跳转根据结构体命名可以直接找对应的,但现在结构体命名都一样了,他就需要根据你的路径去区分,我理解你做这个思路,拆分目录肯定是更有利的,我的疑问可能更集中在所有 cluster 和 invoker 的命名被简化了这一点上(语义被移到了包路径上,这是一个有点奇怪的事)。 |
@Mulavar 现在确实有这个问题,但是 GoLand 里有路径提示,我觉得可能会有所缓解。 |
是的,goland 是有其他的方式可以缓解,只是这种方式相比之前没那么直观。或者反过来看,为什么我们要把这部分语义放到路径中要去掉呢,我认为即使保留在结构体命名中也不影响代码的简洁和精炼? |
@Mulavar Ref: https://go.dev/blog/package-names
|
What this PR does:
The new directory structure is shown at below.
PS: This refactor will be transparent for Dubbo-Go users.
Which issue(s) this PR fixes:
Fixes #1503
Special notes for your reviewer:
Does this PR introduce a user-facing change?: