|
|
|
|
|
by shivylp
2763 days ago
|
|
You are totally right. It would be ideal to have a package called `users` which does everything related to user. But if proper care is not taken while laying out the packages and types that go inside, you might quickly run into cyclic-dependency issues (for the lack of better example: post requiring User type and User requiring post type). This does not happen in encoding/json or enconding/gob because of the fact that they are completely different domains and are simple enough. But in this project for example, they belong to the same domain and user and post entities have a relation between them. I am not saying it's not possible to move towards the pattern you are suggesting. But since i decided to demonstrate Clean Architecture in this, i went with the current pattern which shows clear boundary between layers. In other words, what is used and what you are suggesting are just 2 patterns having their own advantages and disadvantages. It is probably not appropriate to call one or the other `non-Go way`. But now that we have discussed this, i am interesting in trying that as well. Not sure if i should refactor or create a new project. |
|