Applying method injection

In this section, we are going to improve our ACME registration service by applying method injection with perhaps my favorite package in the entire Go standard library, the context package. Central to this package is the Context interface, which describes itself as follows:

A context carries a deadline, cancellation signal, and request-scoped values across API boundaries. Its methods are safe for simultaneous use by multiple goroutines

So, why do I love it so much? By applying method injection, with context as the dependency, I am able to build my processing logic in such a way that it can all be automatically canceled and cleaned up.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.17.27