style(go): add rule against type-only packages (per upaas #126 review) #2

Merged
sneak merged 2 commits from clawbot/prompts:add-no-type-only-packages-rule into main 2026-02-23 22:14:02 +01:00
Showing only changes of commit f9dcef4c9e - Show all commits

View File

@ -229,6 +229,15 @@ last_modified: 2026-02-22
1. Define your struct types near their constructors. 1. Define your struct types near their constructors.
1. Do not create packages whose sole purpose is to hold type definitions.
Packages named `types`, `domain`, or `models` that contain only structs and
interfaces (with no behavior) are a code smell. Define types alongside the
code that uses them. Type-only packages force consuming packages into alias
imports and circular-dependency gymnastics, and indicate that the package
boundaries were drawn around nouns instead of responsibilities. If multiple
packages need the same type, put it in the package that owns the behavior,
or in a small, focused interface package — not in a grab-bag types package.
1. Define your interface types near the functions that use them, or if you have 1. Define your interface types near the functions that use them, or if you have
multiple conformant types, put the interface(s) in their own file. multiple conformant types, put the interface(s) in their own file.