You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some services define a method to be called on termination, often a func (Foo) Close() error to implement io.Closer.
Currently, the container users need to know exactly which services need that, and call these functions in main.
It would be nicer to have the container support auto-closing, by allowing services to register some special termination optional interface the container could close in a single call to err := dic.Close(). The main issue is to ensure closure in in the inverse order of instantation to avoid breaking dependencies.
The text was updated successfully, but these errors were encountered:
Some services define a method to be called on termination, often a
func (Foo) Close() error
to implementio.Closer
.Currently, the container users need to know exactly which services need that, and call these functions in
main
.It would be nicer to have the container support auto-closing, by allowing services to register some special termination optional interface the container could close in a single call to
err := dic.Close()
. The main issue is to ensure closure in in the inverse order of instantation to avoid breaking dependencies.The text was updated successfully, but these errors were encountered: