docs(plugins): note optional dependencies still sit in go.mod

An optional dependency is optional at activation, not at compile time:
importing the package that declares a looked-up type keeps the other
plugin in go.mod; only party.Plugin.Requires leaves it out.
This commit is contained in:
Jakub Zych
2026-10-18 19:16:35 +02:00
parent 533fb7ccd9
commit 97daec593c

View File

@@ -57,6 +57,8 @@ A required dependency goes in `party.Plugin.Requires`, and activation fails when
This replaces `PluginManager::exists` checks in WinterCMS.
Optional here means optional at activation, not at compile time. A plugin that looks up a type declared in another plugin's package imports that package, so the other plugin still appears in its `go.mod`. Only `party.Plugin.Requires` leaves it out. `pact.OptionalMessage` is the way to integrate without that import.
## Model hooks and GORM callbacks
A model reacts to its own lifecycle with GORM hook methods such as `BeforeSave`; [lagoon](../../modules/lagoon/README.md) names them as interfaces (`lagoon.HasBeforeSave`, `lagoon.HasBeforeDelete` and the rest) so you can assert them at compile time.