styleguide: add rule against type-only packages #1
@ -227,6 +227,14 @@ last_modified: 2026-02-22
|
||||
}
|
||||
```
|
||||
|
||||
1. Do not create packages just to hold types (e.g. `types`, `domain`,
|
||||
`models` that contain only type definitions). Define types alongside the
|
||||
implementations that use them. A type-only package is a sign that the types
|
||||
are in the wrong place — move them to the package that actually operates on
|
||||
them. This also avoids awkward import aliases (e.g.
|
||||
`domaintypes "myapp/internal/domain"`) which are a code smell indicating
|
||||
poor package naming.
|
||||
|
||||
1. Define your struct types near their constructors.
|
||||
|
||||
1. Define your interface types near the functions that use them, or if you have
|
||||
|
||||
Loading…
Reference in New Issue
Block a user