Open Hidayathamir opened 2 months ago
To maintain consistency and avoid confusion, it's a good practice to establish a naming convention for imports within your team. Here's an example of how you might import multiple ports with consistent naming:
import (
"errors"
portUser "github.com/damasdev/go-hexagonal-architecture/internal/core/ports/user"
portProduct "github.com/damasdev/go-hexagonal-architecture/internal/core/ports/product"
)
or:
import (
"errors"
"github.com/damasdev/go-hexagonal-architecture/internal/core/ports/user"
"github.com/damasdev/go-hexagonal-architecture/internal/core/ports/product"
)
By following this convention, all team members will use the same aliases, reducing the risk of confusion and inconsistency.
This line of code.
If you have more than one port, for example,
product
, how would you import that port?portProduct "github.com/damasdev/go-hexagonal-architecture/internal/core/ports/product"
?I think if you allow people to rename the import, each team member can import the package with a different name, which will quickly become a mess.