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

resolver: delete Target.Scheme and Target.Authority #6363

Merged
merged 2 commits into from Jul 5, 2023

Conversation

ginayeh
Copy link
Contributor

@ginayeh ginayeh commented Jun 8, 2023

Fixes #5795

RELEASE NOTES:

  • resolver: remove deprecated Target.Scheme and Target.Authority. Use URL.Scheme and URL.Host instead, respectively

@ginayeh ginayeh added the Type: API Change Breaking API changes (experimental APIs only!) label Jun 8, 2023
@ginayeh ginayeh added this to the 1.56 Release milestone Jun 8, 2023
@ginayeh ginayeh requested a review from dfawley June 8, 2023 18:12
@dfawley
Copy link
Member

dfawley commented Jun 8, 2023

FYI the vet checks are failing because you didn't run gofmt. You'll most likely want to set up your IDE to do that automatically on-save. LMK if you need help with that.

@ginayeh
Copy link
Contributor Author

ginayeh commented Jun 8, 2023

Thanks for the hint. I've fixed that in my IDE. Seems like it's passing vet now.

@ginayeh ginayeh changed the title Delete resolver.Target.Scheme and resolver.Target.Authority resolver: delete Target.Scheme and Target.Authority Jun 8, 2023
clientconn.go Outdated
@@ -1807,18 +1807,15 @@ func (cc *ClientConn) parseTargetAndFindResolver() error {
}

// parseTarget uses RFC 3986 semantics to parse the given target into a
// resolver.Target struct containing scheme, authority and url. Query
// params are stripped from the endpoint.
// resolver.Target struct containing url. Query params are stripped from the endpoint.
Copy link
Member

Choose a reason for hiding this comment

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

Please wrap all block comments @ 80 columns.

clientconn.go Outdated
Comment on lines 1817 to 1819
return resolver.Target{
Scheme: u.Scheme,
Authority: u.Host,
URL: *u,
URL: *u,
}, nil
Copy link
Member

Choose a reason for hiding this comment

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

Nit: make the code a little more compact to improve readability:

return resolver.Target{URL: *u}, nil

Comment on lines 69 to 72
_, err := url.Parse(target)
if err != nil {
t.Fatalf("Unexpected error parsing URL: %v", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Delete these lines entirely, please, as they don't do anything except validate our test data, which should already be valid.

Comment on lines 178 to 181
_, err := url.Parse(target)
if err != nil {
t.Fatalf("Unexpected error parsing URL: %v", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Same

@@ -86,14 +86,14 @@ var (
minDNSResRate = 30 * time.Second
)

var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) {
return func(ctx context.Context, network, address string) (net.Conn, error) {
var addressDialer = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: s/authority/address/ since this is an "address dialer" not an "authority dialer" now. And just return type func(context.Context, string, string) (net.Conn, error) { as there's no need to name the arguments to the function returned.

@ginayeh ginayeh force-pushed the 5795 branch 2 times, most recently from 32bf00f to ceb83c4 Compare June 9, 2023 16:40
@tobotg
Copy link
Contributor

tobotg commented Jun 16, 2023

@dfawley @easwars I would like to help review this PR, but could you please clarify this : is the goal of #5795 to remove the deprecated resolver.Target.Authority and resolver.Target.Scheme (that is what the PR is doing, and it's a breaking change) or just clean and remove their usages across the internal codebase? Thanks

@easwars
Copy link
Contributor

easwars commented Jun 27, 2023

Could you please take care of the merge conflict, and if you think you have addressed Doug's comments, feel free to set the assignee back to him.

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.

LGTM, thanks!

  1. Please do a search (again?) internally and make sure nobody is referencing these deprecated fields, and update them before merging this PR if so.

  2. Please don't resolve comments in github code reviews unless you are a reviewer of the PR. Resolving comments makes it hard to see what was asked for by the reviewer, unfortunately. Github is weird that way.

@dfawley dfawley assigned ginayeh and unassigned dfawley Jul 5, 2023
@ginayeh ginayeh merged commit 11feb0a into grpc:master Jul 5, 2023
11 checks passed
@ginayeh ginayeh deleted the 5795 branch July 5, 2023 17:47
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: API Change Breaking API changes (experimental APIs only!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleanup usages of resolver.Target.Authority
5 participants