Company
Date Published
Dec. 21, 2021
Author
Lawrence Jones
Word count
1370
Language
English
Hacker News points
None

Summary

The text discusses a pattern for mocking external client libraries in Go while keeping the code simple and ensuring all the code down a call stack uses the same mock client. This is achieved by generating a mock using tools like interfacer and gomock, and then injecting it with context.Context. The resulting test suite improves developer productivity when writing tests.