wiki: CodeReviewComments should more thoroughly describe test helper functions #30246
Labels
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
The document already covers testing helper functions, and how to use them. I propose to add instructions how to write testing helper functions. Two things that I thought of are:
t *testing.T
.t.Helper()
.The reason for this issue is that currently context is instructed to be the first argument of a function. A testing helper function that I wrote
testCtx(t *testing.T, ctx context.Context)
result in a lint warning - context should always be the first argument. I opened golang/lint#422 and created a fix golang/lint#423, but it was declined for the reason that lint enforces only what's in EffectiveGo and CodeReviewComments.The current state is that if I want to have this function I should declare it as
testCtx(ctx context.Context, t *testing.T)
which fills wrong to me.The text was updated successfully, but these errors were encountered: