3 ms·
Maintaining Go Code at scale, I can tell you decisively that using the context as opaque bag for all-the-values is a bad idea in terms of maintainability and co
by matttproud 3y ago
Maintaining Go Code at scale, I can tell you decisively that using the context as opaque bag for all-the-values is a bad idea in terms of maintainability and code comprehensibility. And I write this agnostic to Go as well; I’d feel exactly the same about using thread local storage for dependency injection purposes.
The advice to use the context as the article proposes is a recipe for a regretted design. I guarantee it. It’s a fun, clever thought experiment but should not be applied to production code.