Repository navigation
v0.4.0
An alpha release. The API can still change before v1.0.
Breaking
yama.Optionis now a function type. It was an interface with one method. Code that builds options withWithInterceptors,WithBeginComponents, andWithEndComponentsneeds no change. Code that named theApplymethod does.
New
-
The closer directive. A
//yama:closercomment in the doc comment of a provider's declaration closes the component in the teardown pass. Yama wraps the component in aStopperthat callsClose. The call runs under the pass context and through theStopinterceptors. This is for a type from a package you do not own, such as*sql.DB.// NewDB provides the database handle. // //yama:closer func NewDB(cfg Config) (*sql.DB, error) { return sql.Open(cfg.Driver, cfg.DSN) }
A
wire.Structentry has no declaration, so its directive goes on the entry in thewire.NewSetcall. -
A warning for a closer that nothing closes. A run prints one line on standard error for a component that implements
io.Closerand has no directive, no cleanup, and noStop. The warning does not stop generation. -
The noclose directive. A
//yama:noclosecomment states that the lifecycle does not close the component, and it stops the warning.
Changed
- A run names its backup files with a
.baksuffix, not a leading dot. A directory listing now shows what an interrupted run left behind. - Regenerate after you upgrade. Generated code calls
rt.AsStopperfor a closer component, so theyamatool and thel7e.io/yamamodule must be the same version.
Full changes: v0.3.0...v0.4.0