Skip to content
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

模块之间有重复代码 #3

Open
EchoGroot opened this issue Jun 7, 2022 · 2 comments
Open

模块之间有重复代码 #3

EchoGroot opened this issue Jun 7, 2022 · 2 comments

Comments

@EchoGroot
Copy link

https://github.com/aliliin/kratos-shop/blob/main/service/user/internal/data/user.go
https://github.com/aliliin/kratos-shop/blob/main/shop/internal/data/user.go

我写go项目也遇到这个问题了,多模块的项目,存在大量重复代码。请问这方面有什么改进的建议吗?

@godsoul
Copy link

godsoul commented Jan 17, 2023

分开有分开的好处,合起来有合起来的好处,合起来代码可以复用,改bug不容易漏改,但是也是因为这个问题,如果你改了代码有bug,会导致所有服务都会有这个bug,一般拆分微服务,都是不同人维护不同的服务的,所以我感觉重复就重复吧。

@mizumoto-cn
Copy link

一点复制粘贴优于彼此依赖,这也是一些Go的设计哲学

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants