Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion client/v3/naming/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package resolver

import (
"context"
"strings"
"sync"

clientv3 "go.etcd.io/etcd/client/v3"
Expand All @@ -31,9 +32,15 @@ type builder struct {
}

func (b builder) Build(target gresolver.Target, cc gresolver.ClientConn, opts gresolver.BuildOptions) (gresolver.Resolver, error) {
// Refer to https://github.com/grpc/grpc-go/blob/16d3df80f029f57cff5458f1d6da6aedbc23545d/clientconn.go#L1587-L1611
endpoint := target.URL.Path
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment above line 35 something like below?

Refer to https://github.com/grpc/grpc-go/blob/16d3df80f029f57cff5458f1d6da6aedbc23545d/clientconn.go#L1587-L1611

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thank you for the review.

if endpoint == "" {
endpoint = target.URL.Opaque
}
endpoint = strings.TrimPrefix(endpoint, "/")
r := &resolver{
c: b.c,
target: target.Endpoint,
target: endpoint,
cc: cc,
}
r.ctx, r.cancel = context.WithCancel(context.Background())
Expand Down