bxcodec / go-clean-arch

Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture
MIT License
9.06k stars 1.19k forks source link

Some questions about naming convention. #18

Closed yojkim closed 5 years ago

yojkim commented 5 years ago

First of all, Thank you for your awesome idea 👍

  1. In main.go, Is there any reason to name like this? I can't understand the detail feature of this convention with an underscore in front of the package name such as _articleRepo

    import (
    _articleHttpDeliver "github.com/bxcodec/go-clean-arch/article/delivery/http"
    _articleRepo "github.com/bxcodec/go-clean-arch/article/repository"
    _articleUcase "github.com/bxcodec/go-clean-arch/article/usecase"
    _authorRepo "github.com/bxcodec/go-clean-arch/author/repository"
    )
  2. Could I allow to add the package unrelated with models? (indirectly related?) Like below tree, I just define user.go in model and implement authentication feature in auth package. I wanted to separate auth package from user. Actually, I'm not sure with this Idea.

    .
    ├── auth
    │   ├── delivery
    │   │   └── http
    │   └── usecase
    ├── model
    └── user
    ├── delivery
    │   └── http
    ├── repository
    └── usecase

Thank you.

bxcodec commented 5 years ago

Hi @yojkim,

  1. Nothing particular reasons, there are no rules about it. It's just how I importing packages here. But if you have a better idea, I'll listen to it :)

  2. Yes, you can do that. So, you will import the user model in the auth package, right? Nothing wrong with that, that's why I separate all models into one package, so every module can import it without having problems with something like circular import, or redundant code.

yojkim commented 5 years ago

Thank you @bxcodec !