-
Notifications
You must be signed in to change notification settings - Fork 912
Replace all uses of mtest.Background with context.Background() #839
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
Replace all uses of mtest.Background with context.Background() #839
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Added a few questions about whether additional go:build
comments were intended. I do not think the answer will block the merge.
@@ -4,6 +4,7 @@ | |||
// not use this file except in compliance with the License. You may obtain | |||
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | |||
|
|||
//go:build cse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intended to be included?
Regardless, adding go:build cse
seems OK to add based on https://stackoverflow.com/a/68361186/774658.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good find! That wasn't intended to be included. As the linked article suggests, looks like it's automatically added by gofmt
if you're using Go 1.17+.
Since it's the official Go formatter adding those and they're backwards-compatible with previous Go versions, I think we should keep them.
@@ -4,6 +4,7 @@ | |||
// not use this file except in compliance with the License. You may obtain | |||
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | |||
|
|||
//go:build go1.13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended to be included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above. Not intentional, but I think we should keep it.
@@ -4,6 +4,7 @@ | |||
// not use this file except in compliance with the License. You may obtain | |||
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | |||
|
|||
//go:build go1.13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above. Not intentional, but I think we should keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a fair change to me. Thanks. LG barring Kevin's question about the build tags.
49bd910
to
9699359
Compare
There is currently an inconsistent mixture between use of
context.Background()
andmtest.Background
context values in tests. Those two values are semantically and functionally identical, butmtest.Background
requires additional knowledge of what that value is, wherecontext.Background()
is a more generally understood stdlib value.Replace all uses of
mtest.Background
withcontext.Background()
and remove themtest.Background
value.