Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: fix missing preposition in docstring #57389

Closed
AndreyBozhko opened this issue Dec 19, 2022 · 8 comments · Fixed by ferrmin/go#548
Closed

testing: fix missing preposition in docstring #57389

AndreyBozhko opened this issue Dec 19, 2022 · 8 comments · Fixed by ferrmin/go#548

Comments

@AndreyBozhko
Copy link
Contributor

The phrase in docstring here

// To write a new test suite, create a file whose name ends _test.go that
reads

... file whose name ends _test.go ...

which instead should probably say

... file whose name ends with _test.go ...
@mvdan
Copy link
Member

mvdan commented Dec 19, 2022

Thanks. Want to send a patch? There's no need to track this change in an issue. See https://go.dev/doc/contribute.

@robpike
Copy link
Contributor

robpike commented Dec 19, 2022

It's also fine as is, no fix needed.

@mvdan
Copy link
Member

mvdan commented Dec 19, 2022

@robpike do you have a link to an explanation, or a name for this form of omitting "with"?

All I can say as a non-native speaker is that I had never seen it before, so I'd definitely find the doc easier to read with the explicit "with".

@robpike
Copy link
Contributor

robpike commented Dec 19, 2022

It's idiomatic English. I probably wrote that sentence myself. The preposition is either assumed or unnecessary. Putting it is correct, but so is leaving it out. To me it sounds right. But if it's bothersome to some, change it.

If I were asked to make it clearer, instead of adding the preposition I would likely add quotes:

// To write a new test suite, create a file whose name ends "_test.go" that 

That demonstrates the text is a literal suffix.

@mvdan
Copy link
Member

mvdan commented Dec 19, 2022

Ah, I see what you mean. I agree that the quotes make it clearer as well.

@lovelytingy
Copy link

Using the word "with" after "ends" clarifies that it is the name of the file that ends with the specified string, rather than the file itself.

In general, it is important to use precise and clear language in order to avoid misunderstandings. In this case, using the word "with" after "ends" helps to make the intended meaning clear.

I am non-native speaker. I find the string easier with the explicit "with".

@AndreyBozhko
Copy link
Contributor Author

Thanks, I will send a patch then. It would also make the language consistent with what is used in other places in the codebase - one example is here

// Note that package and module paths may end with '.go', so only print an error
.

@gopherbot
Copy link

Change https://go.dev/cl/458435 mentions this issue: testing: add clarifying preposition to the docstring

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants