I’m making a switch to context.Context across our codebase. But there’s a problem in the tests. A few of the tests have a testContext that holds a bunch of important objects for the test to examine, and the variable it goes in is named ctx.
Which means I can’t:
var log = blog.UseMock()
var ctx = context.Background()
because they’re both named ctx. I considered contxt but that looks really weird.
Editors and IDEs have auto completion these days. Go for readability: testCtx, testEnv, etc.
Names that would make it easier to understand the code a few months after it is written or for new devs getting up to speed.