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

godoc: clarify WithTimeout deprecation note #3226

Merged
merged 1 commit into from
Dec 12, 2019
Merged

Conversation

ensonic
Copy link
Contributor

@ensonic ensonic commented Dec 4, 2019

Tell people to replace Dial + WithTimeout by DialContext + context.WithTimeout.

@ensonic
Copy link
Contributor Author

ensonic commented Dec 4, 2019

FYI, the travis failure looks unrelated to me, but I don't see how I can ask it to rerun.

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification.

dialoptions.go Outdated
@@ -374,8 +374,8 @@ func init() {
// is returned by f, gRPC checks the error's Temporary() method to decide if it
// should try to reconnect to the network address.
//
// Deprecated: use WithContextDialer instead. Will be supported throughout
// 1.x.
// Deprecated: use WithContextDialer or DialContext instead of Dial. Will be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. WithContextDialer is to be used instead of WithDialer itself. I don't think any change here is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I finally found a working way to port from the deprecated api.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is still incorrect. If you port from grpc.Dial() to grpc.DialContext you don't need WithContextDialer() at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WithContextDialer is the new version of WithDialer. DialContext is the new version of Dial (though Dial itself is not deprecated since a context isn't useful without WithBlock). These are entirely orthogonal.

@dfawley dfawley added this to the 1.26 Release milestone Dec 4, 2019
@dfawley dfawley added the Type: Documentation Documentation or examples label Dec 4, 2019
dialoptions.go Outdated
@@ -46,7 +46,7 @@ type dialOptions struct {
chainUnaryInts []UnaryClientInterceptor
chainStreamInts []StreamClientInterceptor

cp Compressor
cp Compressor* t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't change this. I'll drop the PR:

dialoptions.go Outdated
@@ -374,8 +374,7 @@ func init() {
// is returned by f, gRPC checks the error's Temporary() method to decide if it
// should try to reconnect to the network address.
//
// Deprecated: use WithContextDialer instead. Will be supported throughout
// 1.x.
// Deprecated: use WithContextDialer instead. Will be supported throughout 1.x.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-wrap this to avoid the unnecessary diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you want 2 spaces separating the sentence in the docs. But anyway done.

Tell people to replace Dial + WithTimeout by DialContext + context.WithTimeout.
@dfawley dfawley changed the title Update deprecation note godoc: clarify WithTimeout deprecation note Dec 12, 2019
@dfawley dfawley merged commit 032a379 into grpc:master Dec 12, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants